Browse Source
Merge pull request #161 from hbrunn/8.0-support_branding
Merge pull request #161 from hbrunn/8.0-support_branding
[ADD] support_brandingpull/186/head
Stefan Rijnhart (Therp)
10 years ago
11 changed files with 407 additions and 0 deletions
-
94support_branding/README.rst
-
0support_branding/__init__.py
-
39support_branding/__openerp__.py
-
25support_branding/data/ir_config_parameter.xml
-
48support_branding/i18n/nl.po
-
48support_branding/i18n/support_branding.pot
-
BINsupport_branding/static/description/icon.png
-
5support_branding/static/src/css/support_branding.css
-
114support_branding/static/src/js/support_branding.js
-
17support_branding/static/src/xml/base.xml
-
17support_branding/views/qweb.xml
@ -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:: |
|||
|
|||
<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="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 |
|||
=========== |
|||
|
|||
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. |
|||
If you spotted it first, help us smashing it by providing a detailed and welcomed feedback |
|||
`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**>`_. |
|||
|
|||
|
|||
Credits |
|||
======= |
|||
|
|||
Contributors |
|||
------------ |
|||
|
|||
* Holger Brunn <hbrunn@therp.nl> |
|||
* Stefan Rijnhart <srijnhart@therp.nl> |
|||
|
|||
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. |
@ -0,0 +1,39 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# OpenERP, Open Source Management Solution |
|||
# This module copyright (C) 2012-2015 Therp BV (<http://therp.nl>). |
|||
# |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
{ |
|||
"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', |
|||
], |
|||
} |
@ -0,0 +1,25 @@ |
|||
<?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> |
@ -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..." |
|||
|
@ -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 "" |
|||
|
After Width: 128 | Height: 128 | Size: 13 KiB |
@ -0,0 +1,5 @@ |
|||
.support-branding-submit-form |
|||
{ |
|||
display: inline; |
|||
margin: 0px; |
|||
} |
@ -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('<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(); |
|||
}); |
|||
} |
|||
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')); |
|||
}); |
|||
} |
|||
}); |
|||
}; |
@ -0,0 +1,17 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<templates> |
|||
<t t-extend="CrashManager.error"> |
|||
<t t-jquery="div" t-operation="after"> |
|||
<div> |
|||
<form class="support-branding-submit-form oe_form" action="mailto:" enctype="text/plain" method="get"> |
|||
<input type="hidden" name="subject" t-attf-value="#{session.username}@#{session.db} [#{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 name="description" placeholder="Please fill in how you produced this error..." class="" /> |
|||
</div> |
|||
<button class="oe_highlight">Email to support company</button> |
|||
</form> |
|||
</div> |
|||
</t> |
|||
</t> |
|||
</templates> |
@ -0,0 +1,17 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<openerp> |
|||
<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"></script> |
|||
<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='oe_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> |
|||
</openerp> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue