diff --git a/support_branding/README.rst b/support_branding/README.rst new file mode 100644 index 00000000..949db799 --- /dev/null +++ b/support_branding/README.rst @@ -0,0 +1,94 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :alt: License: AGPL-3 + +Support branding +================ + +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 line `Supported by $yourcompany` in the menu footer and add a button to +mail exception messages to your support email address. + + +Configuration +============= + +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:: + + + Your company + + + https://yourwebsite.com + + + #000 + + + support@yourwebsite.com + + + support@yourwebsite.com + + + 42 + Configuration + +Note that the email button is only visible if you configure an email address, +the default is empty! + +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 +`here `_. + + +Credits +======= + +Contributors +------------ + +* Holger Brunn +* Stefan Rijnhart + +Icon +---- + +* https://commons.wikimedia.org/wiki/File:Crystal_Clear_app_khelpcenter.png + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +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. + +To contribute to this module, please visit http://odoo-community.org. diff --git a/support_branding/__init__.py b/support_branding/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/support_branding/__openerp__.py b/support_branding/__openerp__.py new file mode 100644 index 00000000..a1721c45 --- /dev/null +++ b/support_branding/__openerp__.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# This module copyright (C) 2012-2015 Therp BV (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## +{ + "name": "Support branding", + "summary": "Adds your branding to an Odoo instance", + "category": "Dependecy/Hidden", + "version": "2.0", + "license": "AGPL-3", + "author": "Therp BV,Odoo Community Association (OCA)", + "website": 'http://therp.nl', + "depends": [ + 'web', + ], + "qweb": [ + 'static/src/xml/base.xml', + ], + "data": [ + "data/ir_config_parameter.xml", + 'views/qweb.xml', + ], +} diff --git a/support_branding/data/ir_config_parameter.xml b/support_branding/data/ir_config_parameter.xml new file mode 100644 index 00000000..3ce36ce7 --- /dev/null +++ b/support_branding/data/ir_config_parameter.xml @@ -0,0 +1,25 @@ + + + + + support_branding.company_name + Odoo Community Association (OCA) + + + support_branding.company_url + https://odoo-community.org + + + support_branding.company_color + #b163a3 + + + support_branding.support_email + + + + support_branding.release + + + + diff --git a/support_branding/i18n/nl.po b/support_branding/i18n/nl.po new file mode 100644 index 00000000..374eecbb --- /dev/null +++ b/support_branding/i18n/nl.po @@ -0,0 +1,48 @@ +# 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" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: support_branding +#: view:website:web.menu_secondary +msgid "Version " +msgstr "Versie " + +#. module: support_branding +#: view:website:web.menu_secondary +msgid ", supported by" +msgstr ", ondersteund door" + +#. module: support_branding +#. openerp-web +#: code:addons/support_branding/static/src/js/support_branding.js:39 +#, 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:9 +#, 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:9 +#, python-format +msgid "Please fill in how you produced this error..." +msgstr "Beschrijft u alstublieft de stappen om deze fout te reproduceren..." + diff --git a/support_branding/i18n/support_branding.pot b/support_branding/i18n/support_branding.pot new file mode 100644 index 00000000..c55e08d9 --- /dev/null +++ b/support_branding/i18n/support_branding.pot @@ -0,0 +1,48 @@ +# 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" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: support_branding +#: view:website:web.menu_secondary +msgid "Version " +msgstr "" + +#. module: support_branding +#: view:website:web.menu_secondary +msgid ", supported by" +msgstr "" + +#. module: support_branding +#. openerp-web +#: code:addons/support_branding/static/src/js/support_branding.js:39 +#, python-format +msgid "Email to %s" +msgstr "" + +#. module: support_branding +#. openerp-web +#: code:addons/support_branding/static/src/xml/base.xml:9 +#, python-format +msgid "Email to Company" +msgstr "" + +#. module: support_branding +#. openerp-web +#: code:addons/support_branding/static/src/xml/base.xml:9 +#, python-format +msgid "Please fill in how you produced this error..." +msgstr "" + diff --git a/support_branding/static/description/icon.png b/support_branding/static/description/icon.png new file mode 100644 index 00000000..f181838d Binary files /dev/null and b/support_branding/static/description/icon.png differ 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 00000000..fcac3884 --- /dev/null +++ b/support_branding/static/src/css/support_branding.css @@ -0,0 +1,5 @@ +.support-branding-submit-form +{ + display: inline; + margin: 0px; +} 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 00000000..30534e7d --- /dev/null +++ b/support_branding/static/src/js/support_branding.js @@ -0,0 +1,114 @@ +/* + + Copyright (C) 2012-2015 Therp BV + License: GNU AFFERO GENERAL PUBLIC LICENSE + Version 3 or any later version + + Usage: if you run an OpenERP support company and you support + customers without an OPW, you can brand the OpenERP instance + accordingly using this module. Please enter the two variables + in the code below, 'support_name' and 'support_link'. They will + replace the unfriendly message about the OpenERP instance not + being supported. + + */ + +openerp.support_branding = function(instance) { + var QWeb = instance.web.qweb, + _t = instance.web._t; + + instance.web.CrashManager.include({ + init: function() + { + var self = this, + ir_config_parameter = new openerp.web.Model('ir.config_parameter'); + ir_config_parameter.call( + 'get_param', ['support_branding.support_email']).then( + function(email) + { + self.support_branding_support_email = email; + }); + ir_config_parameter.call( + 'get_param', ['support_branding.company_name']).then( + function(name) + { + self.support_branding_company_name = name; + }); + return this._super(this, arguments); + }, + show_error: function(error) + { + var self = this; + this._super.apply(this, arguments); + jQuery('.support-branding-submit-form').each(function() + { + var $form = jQuery(this), + $button = $form.find('button'), + $description = $form.find('textarea[name="description"]'), + $subject = $form.find('input[name="subject"]'), + $body = $form.find('input[name="body"]'); + if(self.support_branding_support_email) + { + $form.attr( + 'action', + 'mailto:' + self.support_branding_support_email); + $form.parents('.modal').find('.modal-body') + .css('max-height', '70vh'); + $button.click(function(ev) + { + var mail_mail = new instance.web.Model('mail.mail'); + if(!$description.val()) + { + $description.parent().addClass('oe_form_invalid'); + ev.preventDefault(); + return; + } + mail_mail.call( + 'create', + [{ + state: 'outgoing', + auto_delete: false, + email_to: self.support_branding_support_email, + subject: $subject.val(), + body_html: jQuery('
').append( + jQuery('
').text($description.val()), + jQuery('
').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();
+                    });
+                }
+                else
+                {
+                    $description.hide();
+                    $button.hide();
+                }
+                if(self.support_branding_company_name)
+                {
+                    $button.text(
+                        _.str.sprintf(
+                            openerp.web._t('Email to %s'),
+                            self.support_branding_company_name));
+                }
+                $form.prependTo(
+                    $form.parents('.modal-dialog').find('.modal-footer'));
+            });
+        }
+    });
+};
diff --git a/support_branding/static/src/xml/base.xml b/support_branding/static/src/xml/base.xml
new file mode 100644
index 00000000..bcbf8aca
--- /dev/null
+++ b/support_branding/static/src/xml/base.xml
@@ -0,0 +1,17 @@
+
+
+    
+        
+            
+
+ + +
+