diff --git a/setup/support_branding/odoo/addons/support_branding b/setup/support_branding/odoo/addons/support_branding new file mode 120000 index 000000000000..3eb64a52d041 --- /dev/null +++ b/setup/support_branding/odoo/addons/support_branding @@ -0,0 +1 @@ +../../../../support_branding \ No newline at end of file diff --git a/setup/support_branding/setup.py b/setup/support_branding/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/support_branding/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/support_branding/README.rst b/support_branding/README.rst new file mode 100644 index 000000000000..18faf9ab050f --- /dev/null +++ b/support_branding/README.rst @@ -0,0 +1,80 @@ +================ +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, +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. + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Therp BV +* Sunflower IT + +Contributors +~~~~~~~~~~~~ + +* Holger Brunn +* Stefan Rijnhart +* Robert Rottermann +* Kevin Kamau + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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. + +This module is part of the `OCA/web `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/support_branding/__init__.py b/support_branding/__init__.py new file mode 100644 index 000000000000..9416c2a040ce --- /dev/null +++ b/support_branding/__init__.py @@ -0,0 +1,7 @@ +# Copyright 2012-2015 Therp BV () +# Copyright 2016 - Tecnativa - Angel Moya +# Copyright 2017 - redO2oo - Robert Rottermann +# Copyright 2021 Sunflower IT +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import models diff --git a/support_branding/__manifest__.py b/support_branding/__manifest__.py new file mode 100644 index 000000000000..94c4d76b490f --- /dev/null +++ b/support_branding/__manifest__.py @@ -0,0 +1,24 @@ +# Copyright 2012-2015 Therp BV () +# Copyright 2016 - Tecnativa - Angel Moya +# Copyright 2017 - redO2oo - Robert Rottermann +# Copyright 2021 Sunflower IT () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Support Branding", + "summary": "Adds your branding to an Odoo instance", + "category": "Hidden/Tools", + "version": "14.0.1.0.0", + "license": "AGPL-3", + "author": "Therp BV,Sunflower IT,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/web", + "depends": ["web", "base_setup"], + "qweb": [ + "static/src/xml/base.xml", + ], + "data": ["views/asset.xml", "views/res_config_settings.xml"], + "demo": [ + "demo/ir_config_parameter_data.xml", + ], + "installable": True, +} diff --git a/support_branding/demo/ir_config_parameter_data.xml b/support_branding/demo/ir_config_parameter_data.xml new file mode 100644 index 000000000000..ef9bf94170aa --- /dev/null +++ b/support_branding/demo/ir_config_parameter_data.xml @@ -0,0 +1,25 @@ + + + + + support_company + Odoo Community Association + + + support_company_url + https://odoo-community.org + + + support_branding_color + #fff + + + support_email + oca@example.com + + + support_release + 14.0 + + + diff --git a/support_branding/i18n/nl.po b/support_branding/i18n/nl.po new file mode 100644 index 000000000000..6c9c84f4c02e --- /dev/null +++ b/support_branding/i18n/nl.po @@ -0,0 +1,49 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * support_branding +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-01-30 10:05+0000\n" +"PO-Revision-Date: 2015-01-30 10:05+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: support_branding +#: model:ir.ui.view,arch_db:support_branding.menu_secondary +msgid ", supported by" +msgstr ", ondersteund door" + +#. module: support_branding +#. openerp-web +#: code:addons/support_branding/static/src/js/support_branding.js:88 +#, python-format +msgid "Email to %s" +msgstr "E-mail naar %s" + +#. module: support_branding +#. openerp-web +#: code:addons/support_branding/static/src/xml/base.xml:12 +#, python-format +msgid "Email to support company" +msgstr "E-mail naar ondersteunend bedrijf" + +#. module: support_branding +#. openerp-web +#: code:addons/support_branding/static/src/xml/base.xml:10 +#, python-format +msgid "Please fill in how you produced this error..." +msgstr "Beschrijft u alstublieft de stappen om deze fout te reproduceren..." + +#. module: support_branding +#: model:ir.ui.view,arch_db:support_branding.menu_secondary +#, fuzzy +msgid "Version" +msgstr "Versie " diff --git a/support_branding/i18n/sl.po b/support_branding/i18n/sl.po new file mode 100644 index 000000000000..461e0034663b --- /dev/null +++ b/support_branding/i18n/sl.po @@ -0,0 +1,51 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * support_branding +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-08-02 10:23+0200\n" +"PO-Revision-Date: 2015-08-02 10:24+0200\n" +"Last-Translator: Matjaz Mozetic \n" +"Language-Team: \n" +"Language: sl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n" +"%100==4 ? 2 : 3);\n" +"X-Generator: Poedit 1.8.2\n" + +#. module: support_branding +#: model:ir.ui.view,arch_db:support_branding.menu_secondary +msgid ", supported by" +msgstr ", podpora" + +#. module: support_branding +#. openerp-web +#: code:addons/support_branding/static/src/js/support_branding.js:88 +#, python-format +msgid "Email to %s" +msgstr "E-pošta za %s" + +#. module: support_branding +#. openerp-web +#: code:addons/support_branding/static/src/xml/base.xml:12 +#, fuzzy, python-format +msgid "Email to support company" +msgstr "E-pošta za družbo" + +#. module: support_branding +#. openerp-web +#: code:addons/support_branding/static/src/xml/base.xml:10 +#, python-format +msgid "Please fill in how you produced this error..." +msgstr "Opišite, kako ste prišli do te napake..." + +#. module: support_branding +#: model:ir.ui.view,arch_db:support_branding.menu_secondary +#, fuzzy +msgid "Version" +msgstr "Verzija" diff --git a/support_branding/i18n/support_branding.pot b/support_branding/i18n/support_branding.pot new file mode 100644 index 000000000000..a477d0608393 --- /dev/null +++ b/support_branding/i18n/support_branding.pot @@ -0,0 +1,46 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * support_branding +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: support_branding +#: model:ir.ui.view,arch_db:support_branding.menu_secondary +msgid ", supported by" +msgstr "" + +#. module: support_branding +#. openerp-web +#: code:addons/support_branding/static/src/js/support_branding.js:88 +#, python-format +msgid "Email to %s" +msgstr "" + +#. module: support_branding +#. openerp-web +#: code:addons/support_branding/static/src/xml/base.xml:12 +#, python-format +msgid "Email to support company" +msgstr "" + +#. module: support_branding +#. openerp-web +#: code:addons/support_branding/static/src/xml/base.xml:10 +#, python-format +msgid "Please fill in how you produced this error..." +msgstr "" + +#. module: support_branding +#: model:ir.ui.view,arch_db:support_branding.menu_secondary +msgid "Version" +msgstr "" + diff --git a/support_branding/models/__init__.py b/support_branding/models/__init__.py new file mode 100644 index 000000000000..4124bd743b0e --- /dev/null +++ b/support_branding/models/__init__.py @@ -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 diff --git a/support_branding/models/res_config_settings.py b/support_branding/models/res_config_settings.py new file mode 100644 index 000000000000..a07ecccea211 --- /dev/null +++ b/support_branding/models/res_config_settings.py @@ -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") diff --git a/support_branding/readme/CONTRIBUTORS.rst b/support_branding/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000000..697abcab5e59 --- /dev/null +++ b/support_branding/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* Holger Brunn +* Stefan Rijnhart +* Robert Rottermann +* Kevin Kamau diff --git a/support_branding/readme/DESCRIPTION.rst b/support_branding/readme/DESCRIPTION.rst new file mode 100644 index 000000000000..1191583f611f --- /dev/null +++ b/support_branding/readme/DESCRIPTION.rst @@ -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. diff --git a/support_branding/static/description/icon.png b/support_branding/static/description/icon.png new file mode 100644 index 000000000000..3a0328b516c4 Binary files /dev/null and b/support_branding/static/description/icon.png differ diff --git a/support_branding/static/description/index.html b/support_branding/static/description/index.html new file mode 100644 index 000000000000..def7124331fb --- /dev/null +++ b/support_branding/static/description/index.html @@ -0,0 +1,426 @@ + + + + + + +Support Branding + + + +
+

Support Branding

+ + +

Beta License: AGPL-3 OCA/web Translate me on Weblate Try me on Runbot

+

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.

+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +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.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Therp BV
  • +
  • Sunflower IT
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

This module is part of the OCA/web project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/support_branding/static/src/css/support_branding.css b/support_branding/static/src/css/support_branding.css new file mode 100644 index 000000000000..68a68a8e52e8 --- /dev/null +++ b/support_branding/static/src/css/support_branding.css @@ -0,0 +1,8 @@ +.support-branding-submit-form { + display: inline; + margin: 0px; +} + +.support-statement { + margin: 10px 0 10px 0; +} diff --git a/support_branding/static/src/js/res_config_edition.js b/support_branding/static/src/js/res_config_edition.js new file mode 100644 index 000000000000..48ac99cc31a6 --- /dev/null +++ b/support_branding/static/src/js/res_config_edition.js @@ -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); + }, + }); +}); diff --git a/support_branding/static/src/js/support_branding.js b/support_branding/static/src/js/support_branding.js new file mode 100644 index 000000000000..829f739a0383 --- /dev/null +++ b/support_branding/static/src/js/support_branding.js @@ -0,0 +1,176 @@ +/* Copyright 2012-2015 Therp + * Copyright 2016 - Tecnativa - Angel Moya + * Copyright 2017 - redO2oo - Robert Rottermann + * Copyright 2018 - Therp BV + * Copyright 2021 - Sunflower IT + * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ + +odoo.define("support_branding.CrashManager", function (require) { + "use strict"; + var CrashManager = require("web.CrashManager").CrashManager; + var session = require("web.session"); + var core = require("web.core"); + + var _t = core._t; + + CrashManager.include({ + init: function () { + var self = this; + $.when(this._super.apply(this, arguments)).then(function () { + self._rpc({ + model: "ir.config_parameter", + method: "get_param", + args: ["support_company"], + }).then(function (name) { + self.support_cp_name = name; + }); + + self._rpc({ + model: "ir.config_parameter", + method: "get_param", + args: ["support_company_url"], + }).then(function (url) { + self.support_cp_url = url; + }); + + 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) { + var self = this; + var dialog = this._super.apply(this, arguments); + var subject = + session.username + + "@" + + session.db + + "[" + + session.server + + "]:" + + error.message; + var body = error.data.debug; + var inputs = + "" + + '\n" + + '"; + dialog.opened(function () { + var $form = $(".support-branding-submit-form"); + var $statement = $(".support-statement"); + var $description = $(".support-desc"); + var $button = $(".support-btn"); + var $close_btn = $(".close"); + 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; + $('

' + title + "

").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 + .parents(".modal") + .find(".modal-body") + .css("max-height", "70vh"); + $button.on("click", function (ev) { + var $btn = $(this); + if (!$description.val()) { + $description.parent().addClass("oe_form_invalid"); + ev.preventDefault(); + return; + } + ev.preventDefault(); + var desc = $description.val(); + var params = { + state: "outgoing", + auto_delete: true, + email_to: self.support_cp_email, + subject: subject, + body_html: jQuery("
") + .append( + jQuery("
").text(desc), + jQuery("
").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 () {
+                                        self.do_notify(
+                                            "Success",
+                                            "Support mail created!"
+                                        );
+                                        $close_btn.click();
+                                    });
+                                }
+                            },
+                            function () {
+                                $body.val(desc + "\n" + $body.val());
+                                $btn.unbind("click");
+                                $btn.click();
+                            }
+                        );
+                    });
+                } else {
+                    $description.css({display: "none"});
+                    $button.css({display: "none"});
+                }
+                $form.prependTo($footer);
+                // Hide "Ok" button since we have close on the dialog top
+                // Allow send email btn to close once done.
+                $footer.find("button:eq(1)").css({display: "none"});
+
+                if (self.support_cp_color) {
+                    $header.css({background: self.support_cp_color});
+                    $footer.css({background: self.support_cp_color});
+                } else {
+                    $header.css({background: ""});
+                    $footer.css({background: ""});
+                }
+            });
+        },
+    });
+});
diff --git a/support_branding/static/src/js/user_menu.js b/support_branding/static/src/js/user_menu.js
new file mode 100644
index 000000000000..f0c76ba45256
--- /dev/null
+++ b/support_branding/static/src/js/user_menu.js
@@ -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);
+        },
+    });
+});
diff --git a/support_branding/static/src/xml/base.xml b/support_branding/static/src/xml/base.xml
new file mode 100644
index 000000000000..4e1e1ff4fb22
--- /dev/null
+++ b/support_branding/static/src/xml/base.xml
@@ -0,0 +1,65 @@
+
+
+    
+        
+            
+
+
+