[MIG] support_branding: Migration to 14.0

pull/1976/head
KKamaa 2021-07-08 05:10:18 +03:00
parent 8d5d047f85
commit 34f1bca55b
21 changed files with 932 additions and 229 deletions

View File

@ -1 +0,0 @@
__import__('pkg_resources').declare_namespace(__name__)

View File

@ -1 +0,0 @@
__import__('pkg_resources').declare_namespace(__name__)

View File

@ -1,92 +1,80 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:alt: License: AGPL-3
Support branding
================ ================
Support Branding
================
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
:target: https://github.com/OCA/web/tree/14.0/support_branding
:alt: OCA/web
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/web-14-0/web-14-0-support_branding
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/162/14.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
If you run an Odoo support company and you support customers without an OPW, If you run an Odoo support company and you support customers without an OPW,
you can brand the Odoo instance accordingly using this module. This module will you can brand the Odoo instance accordingly using this module. This module will
add a line `Supported by $yourcompany` in the menu footer and add a button to add a support company url to profile menu under, `Support`. Moreover,
mail exception messages to your support email address. it will add a button to mail exception messages to your support email address.
**Table of contents**
Configuration .. contents::
============= :local:
This module is controlled by config parameters:
support_branding.company_name
Your company's name
support_branding.company_url
Your company's website
support_branding.company_color
The color to show your company's name in (CSS syntax)
support_branding.support_email
The (optional) mailaddress to contact for support
support_branding.release
The (optional) version number of your deployment
You probably want to depend on this module in your customer specific module and
add the following XML::
<record id="support_branding.config_parameter_company_name" model="ir.config_parameter">
<field name="value">Your company</field>
</record>
<record id="support_branding.config_parameter_company_url" model="ir.config_parameter">
<field name="value">https://yourwebsite.com</field>
</record>
<record id="support_branding.config_parameter_company_color" model="ir.config_parameter">
<field name="value">#000</field>
</record>
<record id="support_branding.config_parameter_support_email" model="ir.config_parameter">
<field name="value">support@yourwebsite.com</field>
</record>
<record id="config_parameter_release" model="ir.config_parameter">
<field name="value">42</field>
</record>Configuration
Note that the email button is only visible if you configure an email address,
the default is empty!
Bug Tracker Bug Tracker
=========== ===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_. Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
In case of trouble, please check there if your issue has already been reported. In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed feedback If you spotted it first, help us smashing it by providing a detailed and welcomed
`here <https://github.com/OCA/web/issues/new?body=module:%20support_branding%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. `feedback <https://github.com/OCA/web/issues/new?body=module:%20support_branding%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
Credits Credits
======= =======
Authors
~~~~~~~
* Therp BV
* Sunflower IT
Contributors Contributors
------------ ~~~~~~~~~~~~
* Holger Brunn <hbrunn@therp.nl> * Holger Brunn <hbrunn@therp.nl>
* Stefan Rijnhart <srijnhart@therp.nl> * Stefan Rijnhart <srijnhart@therp.nl>
* Robert Rottermann <robert@redo2oo.ch> * Robert Rottermann <robert@redo2oo.ch>
* Kevin Kamau <kevin@sunflowerweb.nl>
Icon Maintainers
---- ~~~~~~~~~~~
* https://commons.wikimedia.org/wiki/File:Crystal_Clear_app_khelpcenter.png This module is maintained by the OCA.
Maintainer
----------
.. image:: https://odoo-community.org/logo.png .. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association :alt: Odoo Community Association
:target: https://odoo-community.org :target: https://odoo-community.org
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use. promote its widespread use.
To contribute to this module, please visit http://odoo-community.org. This module is part of the `OCA/web <https://github.com/OCA/web/tree/14.0/support_branding>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@ -0,0 +1,7 @@
# Copyright 2012-2015 Therp BV (<http://therp.nl>)
# Copyright 2016 - Tecnativa - Angel Moya <odoo@tecnativa.com>
# Copyright 2017 - redO2oo - Robert Rottermann <robert@redO2oo.ch>
# Copyright 2021 Sunflower IT
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import models

View File

@ -1,25 +1,24 @@
# Copyright 2012-2015 Therp BV (<http://therp.nl>) # Copyright 2012-2015 Therp BV (<http://therp.nl>)
# Copyright 2016 - Tecnativa - Angel Moya <odoo@tecnativa.com> # Copyright 2016 - Tecnativa - Angel Moya <odoo@tecnativa.com>
# Copyright 2017 - redO2oo - Robert Rottermann <robert@redO2oo.ch> # Copyright 2017 - redO2oo - Robert Rottermann <robert@redO2oo.ch>
# Copyright 2021 Sunflower IT (<https://www.sunflowerweb.nl>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{ {
"name": "Support branding", "name": "Support Branding",
"summary": "Adds your branding to an Odoo instance", "summary": "Adds your branding to an Odoo instance",
"category": "Dependecy/Hidden", "category": "Hidden/Tools",
"version": "10.0.1.0.0", "version": "14.0.1.0.0",
"license": "AGPL-3", "license": "AGPL-3",
"author": "Therp BV,Odoo Community Association (OCA)", "author": "Therp BV,Sunflower IT,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/web", "website": "https://github.com/OCA/web",
"depends": [ "depends": ["web", "base_setup"],
"web",
],
"qweb": [ "qweb": [
"static/src/xml/base.xml", "static/src/xml/base.xml",
], ],
"data": [ "data": ["views/asset.xml", "views/res_config_settings.xml"],
"data/ir_config_parameter.xml", "demo": [
"views/qweb.xml", "demo/ir_config_parameter_data.xml",
], ],
"installable": True, "installable": True,
} }

View File

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<openerp>
<data noupdate="0">
<record id="config_parameter_company_name" model="ir.config_parameter">
<field name="key">support_branding.company_name</field>
<field name="value">Odoo Community Association (OCA)</field>
</record>
<record id="config_parameter_company_url" model="ir.config_parameter">
<field name="key">support_branding.company_url</field>
<field name="value">https://odoo-community.org</field>
</record>
<record id="config_parameter_company_color" model="ir.config_parameter">
<field name="key">support_branding.company_color</field>
<field name="value">#b163a3</field>
</record>
<record id="config_parameter_support_email" model="ir.config_parameter">
<field name="key">support_branding.support_email</field>
<field name="value" eval="''" />
</record>
<record id="config_parameter_release" model="ir.config_parameter">
<field name="key">support_branding.release</field>
<field name="value" eval="''" />
</record>
</data>
</openerp>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<data noupdate="0">
<record id="demo_config_parameter_company_name" model="ir.config_parameter">
<field name="key">support_company</field>
<field name="value">Sunflower IT</field>
</record>
<record id="demo_config_parameter_company_url" model="ir.config_parameter">
<field name="key">support_company_url</field>
<field name="value">https://www.sunflowerweb.nl</field>
</record>
<record id="demo_config_parameter_company_color" model="ir.config_parameter">
<field name="key">support_branding_color</field>
<field name="value">#fff</field>
</record>
<record id="demo_config_parameter_support_email" model="ir.config_parameter">
<field name="key">support_email</field>
<field name="value">info@sunflowerweb.nl</field>
</record>
<record id="demo_config_parameter_release" model="ir.config_parameter">
<field name="key">support_release</field>
<field name="value">14.0</field>
</record>
</data>
</odoo>

View File

@ -0,0 +1,4 @@
# Copyright 2021 Sunflower IT
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import res_config_settings

View File

@ -0,0 +1,36 @@
# Copyright 2021 Sunflower IT
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import fields, models
class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"
def get_values(self):
res = super(ResConfigSettings, self).get_values()
param_obj = self.env["ir.config_parameter"].sudo()
res.update(
support_company=param_obj.get_param("support_company"),
support_company_url=param_obj.get_param("support_company_url"),
support_email=param_obj.get_param("support_email"),
support_release=param_obj.get_param("support_release"),
support_branding_color=param_obj.get_param("support_branding_color"),
)
return res
def set_values(self):
res = super(ResConfigSettings, self).set_values()
param_obj = self.env["ir.config_parameter"].sudo()
param_obj.set_param("support_company", self.support_company)
param_obj.set_param("support_company_url", self.support_company_url)
param_obj.set_param("support_email", self.support_email)
param_obj.set_param("support_release", self.support_release)
param_obj.set_param("support_branding_color", self.support_branding_color)
return res
support_company = fields.Char(string="Company Name")
support_company_url = fields.Char(string="Company URL")
support_branding_color = fields.Char(string="Branding color")
support_email = fields.Char(string="Support email")
support_release = fields.Char(string="Support release")

View File

@ -0,0 +1,4 @@
* Holger Brunn <hbrunn@therp.nl>
* Stefan Rijnhart <srijnhart@therp.nl>
* Robert Rottermann <robert@redo2oo.ch>
* Kevin Kamau <kevin@sunflowerweb.nl>

View File

@ -0,0 +1,4 @@
If you run an Odoo support company and you support customers without an OPW,
you can brand the Odoo instance accordingly using this module. This module will
add a support company url to profile menu under, `Support`. Moreover,
it will add a button to mail exception messages to your support email address.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@ -0,0 +1,426 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<title>Support Branding</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="support-branding">
<h1 class="title">Support Branding</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/web/tree/14.0/support_branding"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/web-14-0/web-14-0-support_branding"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/162/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>If you run an Odoo support company and you support customers without an OPW,
you can brand the Odoo instance accordingly using this module. This module will
add a support company url to profile menu under, <cite>Support</cite>. Moreover,
it will add a button to mail exception messages to your support email address.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#bug-tracker" id="id1">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id2">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id3">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id4">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id5">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/web/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20support_branding%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#id2">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#id3">Authors</a></h2>
<ul class="simple">
<li>Therp BV</li>
<li>Sunflower IT</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id4">Contributors</a></h2>
<ul class="simple">
<li>Holger Brunn &lt;<a class="reference external" href="mailto:hbrunn&#64;therp.nl">hbrunn&#64;therp.nl</a>&gt;</li>
<li>Stefan Rijnhart &lt;<a class="reference external" href="mailto:srijnhart&#64;therp.nl">srijnhart&#64;therp.nl</a>&gt;</li>
<li>Robert Rottermann &lt;<a class="reference external" href="mailto:robert&#64;redo2oo.ch">robert&#64;redo2oo.ch</a>&gt;</li>
<li>Kevin Kamau &lt;<a class="reference external" href="mailto:kevin&#64;sunflowerweb.nl">kevin&#64;sunflowerweb.nl</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id5">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/14.0/support_branding">OCA/web</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
</div>
</body>
</html>

View File

@ -2,3 +2,7 @@
display: inline; display: inline;
margin: 0px; margin: 0px;
} }
.support-statement {
margin: 10px 0 10px 0;
}

View File

@ -0,0 +1,33 @@
odoo.define("support_branding.ResConfigEdition", function (require) {
"use strict";
var ResConfigEdition = require("base_setup.ResConfigEdition");
ResConfigEdition.include({
willStart: function () {
var self = this;
var def_1 = this._rpc({
model: "ir.config_parameter",
method: "get_param",
args: ["support_company"],
}).then(function (name) {
self.support_cp_name = name;
});
var def_2 = this._rpc({
model: "ir.config_parameter",
method: "get_param",
args: ["support_company_url"],
}).then(function (url) {
self.support_cp_url = url;
});
var def_3 = this._rpc({
model: "ir.config_parameter",
method: "get_param",
args: ["support_email"],
}).then(function (email) {
self.support_cp_email = email;
});
return $.when(this._super.apply(this, arguments), def_1, def_2, def_3);
},
});
});

View File

@ -2,105 +2,169 @@
* Copyright 2016 - Tecnativa - Angel Moya <odoo@tecnativa.com> * Copyright 2016 - Tecnativa - Angel Moya <odoo@tecnativa.com>
* Copyright 2017 - redO2oo - Robert Rottermann <robert@redO2oo.ch> * Copyright 2017 - redO2oo - Robert Rottermann <robert@redO2oo.ch>
* Copyright 2018 - Therp BV * Copyright 2018 - Therp BV
* Copyright 2021 - Sunflower IT
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
odoo.define("web.support_branding", function (require) { odoo.define("support_branding.CrashManager", function (require) {
var CrashManager = require("web.CrashManager"); "use strict";
var core = require("web.core"); var CrashManager = require("web.CrashManager").CrashManager;
var Model = require("web.Model");
var session = require("web.session"); var session = require("web.session");
var core = require("web.core");
var _t = core._t; var _t = core._t;
CrashManager.include({ CrashManager.include({
init: function () { init: function () {
var self = this, var self = this;
ir_config_parameter = new Model("ir.config_parameter"); $.when(this._super.apply(this, arguments)).then(function () {
ir_config_parameter self._rpc({
.call("get_param", ["support_branding.support_email"]) model: "ir.config_parameter",
.then(function (email) { method: "get_param",
self.support_branding_support_email = email; args: ["support_company"],
}).then(function (name) {
self.support_cp_name = name;
}); });
ir_config_parameter
.call("get_param", ["support_branding.company_name"]) self._rpc({
.then(function (name) { model: "ir.config_parameter",
self.support_branding_company_name = name; method: "get_param",
args: ["support_company_url"],
}).then(function (url) {
self.support_cp_url = url;
}); });
return this._super(this, arguments);
self._rpc({
model: "ir.config_parameter",
method: "get_param",
args: ["support_email"],
}).then(function (email) {
self.support_cp_email = email;
});
self._rpc({
model: "ir.config_parameter",
method: "get_param",
args: ["support_release"],
}).then(function (release) {
self.support_cp_release = release;
});
self._rpc({
model: "ir.config_parameter",
method: "get_param",
args: ["support_branding_color"],
}).then(function (color) {
self.support_cp_color = color;
});
});
}, },
show_error: function (error) { show_error: function (error) {
var self = this; var self = this;
error._session = session; var dialog = this._super.apply(this, arguments);
this._super.apply(this, arguments); var subject =
jQuery(".support-branding-submit-form").each(function () { session.username +
var $form = jQuery(this), "@" +
$button = $form.find("button"), session.db +
$description = $form.find('textarea[name="description"]'), "[" +
$subject = $form.find('input[name="subject"]'), session.server +
$body = $form.find('input[name="body"]'); "]:" +
if (self.support_branding_support_email) { error.message;
$form.attr( var body = error.data.debug;
"action", var inputs =
"mailto:" + self.support_branding_support_email "" +
); '<input type="hidden" name="subject" value=' +
subject +
"/>\n" +
'<input type="hidden" class="sp-body" name="body" value=\'' +
body +
"'/>";
dialog.opened(function () {
var $form = $(".support-branding-submit-form");
var $statement = $(".support-statement");
var $description = $(".support-desc");
var $button = $(".support-btn");
var $body = $(".sp-body");
var $header = $form.parents(".modal-dialog").find(".modal-header");
var $footer = $form.parents(".modal-dialog").find(".modal-footer");
$statement.prepend(inputs);
if (self.support_cp_email) {
if (self.support_cp_name) {
var title = "Support By " + self.support_cp_name;
$('<h3 class="text-primary">' + title + "</h3>").insertBefore(
".support-branding-submit-form"
);
$button.text(
_.str.sprintf(_t("Email to %s"), self.support_cp_name)
);
}
$form.attr("action", "mailto:" + self.support_cp_email);
$form $form
.parents(".modal") .parents(".modal")
.find(".modal-body") .find(".modal-body")
.css("max-height", "70vh"); .css("max-height", "70vh");
$button.click(function (ev) { $button.on("click", function (ev) {
var mail_mail = new Model("mail.mail"); var $btn = $(this);
if (!$description.val()) { if (!$description.val()) {
$description.parent().addClass("oe_form_invalid"); $description.parent().addClass("oe_form_invalid");
ev.preventDefault(); ev.preventDefault();
return; return;
} }
mail_mail
.call("create", [
{
state: "outgoing",
auto_delete: true,
email_to: self.support_branding_support_email,
subject: $subject.val(),
body_html: jQuery("<div/>")
.append(
jQuery("<div/>").text($description.val()),
jQuery("<pre/>").text($body.val())
)
.html(),
},
])
.then(
function (mail_id) {
return mail_mail.call("send", [[mail_id]]);
},
function () {
// If the call failed, fire the mailto link
// hoping there is a properly configured email
// client
$body.val($description.val() + "\n" + $body.val());
$button.unbind("click");
$button.click();
}
)
.then(function () {
$form.parents(".modal").modal("hide");
});
ev.preventDefault(); ev.preventDefault();
var desc = $description.val();
var params = {
state: "outgoing",
auto_delete: true,
email_to: self.support_cp_email,
subject: subject,
body_html: jQuery("<div/>")
.append(
jQuery("<div/>").text(desc),
jQuery("<pre/>").text(body)
)
.html(),
};
self._rpc({
model: "mail.mail",
method: "create",
args: [params],
}).then(
function (mail_id) {
if (mail_id) {
self._rpc({
model: "mail.mail",
method: "send",
args: [mail_id],
}).then(function (res) {
if (res) {
self.do_notify(
"Success",
"Support mail created!"
);
}
});
}
},
function () {
$body.val(desc + "\n" + $body.val());
$btn.unbind("click");
$btn.click();
}
);
}); });
} else { } else {
$description.hide(); $description.css({display: "none"});
$button.hide(); $button.css({display: "none"});
} }
if (self.support_branding_company_name) { $form.prependTo($footer);
$button.text( if (self.support_cp_color) {
_.str.sprintf( $header.css({background: self.support_cp_color});
_t("Email to %s"), $footer.css({background: self.support_cp_color});
self.support_branding_company_name } else {
) $header.css({background: ""});
); $footer.css({background: ""});
} }
$form.prependTo($form.parents(".modal-dialog").find(".modal-footer"));
}); });
}, },
}); });
// This is already instantiated, so we need to call init manually
require("web.crash_manager").init();
}); });

View File

@ -0,0 +1,27 @@
odoo.define("support_branding.UserMenu", function (require) {
"use strict";
var user_menu = require("web.UserMenu");
user_menu.include({
_onMenuSupport: function () {
var url = this.support_url || "https://www.odoo.com/buy";
window.open(url, "_blank");
},
willStart: function () {
var self = this;
var def = self
._rpc({
model: "ir.config_parameter",
method: "get_param",
args: ["support_company_url"],
})
.then(function (site) {
if (site && site !== "") {
self.support_url = site;
}
});
return $.when(this._super.apply(this, arguments), def);
},
});
});

View File

@ -1,36 +1,64 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<templates> <templates>
<t t-extend="CrashManager.error"> <t t-extend="CrashManager.error">
<t t-jquery="div" t-operation="after"> <t t-jquery="div.o_error_detail" t-operation="after">
<div> <div class="container">
<form <form
class="support-branding-submit-form oe_form" class="support-branding-submit-form oe_form"
action="mailto:" action="mailto:"
enctype="text/plain" enctype="text/plain"
method="get" method="get"
> >
<input <div class="support-statement oe_form_field_text oe_form_required">
type="hidden"
name="subject"
t-attf-value="#{error._session.username}@#{error._session.db} [#{error._session.server}]: #{error.message}"
/>
<input
type="hidden"
name="body"
t-attf-value="#{error.data.debug}"
/>
<div class="oe_form_field_text oe_form_required">
<textarea <textarea
name="description" name="description"
placeholder="Please fill in how you produced this error..." placeholder="Please fill in how you produced this error..."
class="" class="support-desc"
/> />
</div> </div>
<button <button class="support-btn btn btn-primary">Email to support
class="btn btn-sm btn-primary" company</button>
>Email to support company</button>
</form> </form>
</div> </div>
</t> </t>
</t> </t>
<t t-extend="res_config_edition">
<t t-jquery="div#edition" t-operation="after">
<t
t-if="widget.support_cp_name and widget.support_cp_url and widget.support_cp_email"
>
<div class="col-12 o_setting_box" id="edition">
<div class="o_setting_right_pane">
<div class="user-heading">
<h3>
Technical Support By
<t t-esc="widget.support_cp_name" />
</h3>
</div>
<div class="tab-content">
<div
role="tabpanel"
id="settings"
class="tab-pane active text-muted o_web_settings_compact_subtitle"
>
<small>For Support visit our
<a
target="_blank"
t-attr-href="{{widget.support_cp_url}}"
style="text-decoration: underline;"
>
website</a> or mail us at
<a
target="_blank"
t-attr-href="mailto:{{widget.support_cp_email}}"
style="text-decoration: underline;"
>
<t t-esc="widget.support_cp_email" /></a></small>
</div>
</div>
</div>
</div>
</t>
</t>
</t>
</templates> </templates>

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template
id="assets_backend"
name="support_branding assets"
inherit_id="web.assets_backend"
>
<xpath expr="." position="inside">
<link
rel="stylesheet"
type="text/css"
href="/support_branding/static/src/css/support_branding.css"
/>
<script
type="text/javascript"
src="/support_branding/static/src/js/user_menu.js"
/>
<script
type="text/javascript"
src="/support_branding/static/src/js/res_config_edition.js"
/>
<script
type="text/javascript"
src="/support_branding/static/src/js/support_branding.js"
/>
</xpath>
</template>
</odoo>

View File

@ -1,43 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<data>
<template
id="support_branding_assets"
name="support_branding assets"
inherit_id="web.assets_backend"
>
<xpath expr="." position="inside">
<script
type="text/javascript"
src="/support_branding/static/src/js/support_branding.js"
/>
<link
rel="stylesheet"
href="/support_branding/static/src/css/support_branding.css"
/>
</xpath>
</template>
<template id="menu_secondary" inherit_id="web.menu_secondary">
<xpath expr="//div[@class='o_sub_menu_footer']" position="inside">
<span>, supported by
<a
target="_new"
t-att-href="request.env['ir.config_parameter'].get_param('support_branding.company_url')"
t-att-style="'color: ' + request.env['ir.config_parameter'].get_param('support_branding.company_color')"
>
<t
t-esc="request.env['ir.config_parameter'].get_param('support_branding.company_name')"
/>
</a>
</span>
<div
t-if="request.env['ir.config_parameter'].get_param('support_branding.release')"
>
Version <t
t-esc="request.env['ir.config_parameter'].get_param('support_branding.release')"
/>
</div>
</xpath>
</template>
</data>
</odoo>

View File

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="support_res_config_settings_view_form" model="ir.ui.view">
<field name="name">support.res.config.settings.view.form</field>
<field name="model">res.config.settings</field>
<field name="priority" eval="10" />
<field name="inherit_id" ref="base.res_config_settings_view_form" />
<field name="arch" type="xml">
<xpath expr="//div[hasclass('settings')]" position="inside">
<div
class="app_settings_block"
data-string="Support Settings"
string="Support Settings"
data-key="support_company"
>
<h2>Support Company Settings</h2>
<div
class="row mt16 o_settings_container"
id="support_company_settings"
>
<div class="col-12 col-lg-6 o_setting_box">
<div class="content-group">
<div class="row mt16">
<div class="o_setting_right_pane">
<!-- Support Details -->
<!-- Name -->
<label for="support_company" />
<div class="text-muted">
Add the support company name
e.g Odoo Community Association (OCA)
</div>
<div class="content-group">
<div class="mt16">
<field name="support_company" />
</div>
</div>
<br />
<!-- URL -->
<label for="support_company_url" />
<div class="text-muted">
Add the support company URL
e.g https://odoo-community.org
</div>
<div class="content-group">
<div class="mt16">
<field name="support_company_url" />
</div>
</div>
<br />
<!-- Branding Color -->
<label for="support_branding_color" />
<div class="text-muted">
Add a branding color
e.g #b163a3
</div>
<div class="content-group">
<div class="mt16">
<field name="support_branding_color" />
</div>
</div>
<br />
<!-- Email -->
<label for="support_email" />
<div class="text-muted">
Add the support email to send issues
e.g info@helpdesksupport.com
</div>
<div class="content-group">
<div class="mt16">
<field name="support_email" />
</div>
</div>
<br />
<!-- Release -->
<label for="support_release" />
<div class="text-muted">
Add the support release
</div>
<div class="content-group">
<div class="mt16">
<field name="support_release" />
</div>
</div>
<br />
</div>
</div>
</div>
</div>
</div>
</div>
</xpath>
</field>
</record>
</odoo>