From 847e873e42d851bdb8e4f8c2e628e264f6a2a2fb Mon Sep 17 00:00:00 2001 From: darshan-serpent Date: Tue, 28 Feb 2017 15:56:41 +0530 Subject: [PATCH] [MIG] mail_debrand v9 --- mail_debrand/README.rst | 14 ++-- mail_debrand/__init__.py | 3 - mail_debrand/__openerp__.py | 14 ++-- mail_debrand/data/mail_data.xml | 109 ++++++++++++++++++++++++++++++++ mail_debrand/models/__init__.py | 5 -- mail_debrand/models/mail.py | 51 --------------- mail_debrand/tests/__init__.py | 5 -- mail_debrand/tests/test_mail.py | 71 --------------------- 8 files changed, 124 insertions(+), 148 deletions(-) create mode 100644 mail_debrand/data/mail_data.xml delete mode 100644 mail_debrand/models/__init__.py delete mode 100644 mail_debrand/models/mail.py delete mode 100644 mail_debrand/tests/__init__.py delete mode 100644 mail_debrand/tests/test_mail.py diff --git a/mail_debrand/README.rst b/mail_debrand/README.rst index 2a813836..bb87a3d8 100644 --- a/mail_debrand/README.rst +++ b/mail_debrand/README.rst @@ -21,7 +21,7 @@ To use this module, you need to: .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/205/8.0 + :target: https://runbot.odoo-community.org/runbot/205/9.0 Bug Tracker =========== @@ -29,11 +29,7 @@ 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 -`_. +help us smashing it by providing a detailed and welcomed feedback. Credits ======= @@ -41,8 +37,10 @@ Credits Contributors ------------ -* Rafael Blasco -* Jairo Llopis +* Rafael Blasco +* Jairo Llopis +* Jordi Ballester Alomar +* Darshan Patel Maintainer ---------- diff --git a/mail_debrand/__init__.py b/mail_debrand/__init__.py index ac009a20..94673b34 100644 --- a/mail_debrand/__init__.py +++ b/mail_debrand/__init__.py @@ -1,5 +1,2 @@ # -*- coding: utf-8 -*- -# © 2016 Antiun Ingeniería S.L. - Jairo Llopis # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -from . import models diff --git a/mail_debrand/__openerp__.py b/mail_debrand/__openerp__.py index 220e0212..62d2258c 100644 --- a/mail_debrand/__openerp__.py +++ b/mail_debrand/__openerp__.py @@ -1,16 +1,20 @@ # -*- coding: utf-8 -*- -# © 2016 Antiun Ingeniería S.L. - Jairo Llopis +# Copyright 2016 Tecnativa - Jairo Llopis +# Copyright 2017 SerpentCS - Darshan Patel # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { "name": "Mail Debrand", - "summary": "Remove Odoo branding from email footers", - "version": "8.0.1.0.0", + "summary": "Remove Odoo branding in sent emails", + "version": "9.0.1.0.0", "category": "Social Network", - "website": "http://www.antiun.com", - "author": "Antiun Ingeniería S.L., Odoo Community Association (OCA)", + "website": "https://www.tecnativa.com", + "author": "Tecnativa, " + "Eficent, " + "Odoo Community Association (OCA)", "license": "AGPL-3", "application": False, "installable": True, + "data": ["data/mail_data.xml"], "depends": [ "mail", ], diff --git a/mail_debrand/data/mail_data.xml b/mail_debrand/data/mail_data.xml new file mode 100644 index 00000000..54d83736 --- /dev/null +++ b/mail_debrand/data/mail_data.xml @@ -0,0 +1,109 @@ + + + + + + +
+ % if ctx.get('button_access'): + + + % endif + +
+ +
+ + + + + +
+ % if ctx.get('button_access'): + ${ctx['button_access']['title']} + % endif + + % if ctx.get('button_follow'): + ${ctx['button_follow']['title']} + + % elif ctx.get('button_unfollow'): + ${ctx['button_unfollow']['title']} + % endif + + % if not ctx.get('button_access') and not ctx.get('button_follow') and not ctx.get('button_unfollow') and ctx.get('model_name'): +

+ About ${ctx['model_name']} + % if ctx.get('record_name'): + : ${ctx['record_name']} + % endif + +

+ % endif +
+

+ % if ctx.get('actions'): + % for action in ctx['actions']: + ${action['title']} + %if cmp(len(ctx['actions']), 1) == 1 and cmp(len(ctx['actions']), loop.index) == 1: + | + % endif + % endfor + % else: + Sent by + % if ctx.get('website_url'): + + % endif + ${ctx.get('company_name')} + % if ctx.get('website_url'): + + % endif + % endif +

+
+
+
+ + + + +
+
+
+
+
+
+
+ + + + +
+ ${object.body | safe} + % if ctx.get('tracking'): +
    + % for tracking in ctx['tracking'] +
  • ${tracking[0]} : ${tracking[1]} -> ${tracking[2]}
  • + % endfor +
+ % endif +
+
+% if ctx.get('signature'): +
+ + + + +
+ ${ctx['signature'] | safe} +
+
+% endif +]]> +
+
+ +
diff --git a/mail_debrand/models/__init__.py b/mail_debrand/models/__init__.py deleted file mode 100644 index 831774a4..00000000 --- a/mail_debrand/models/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# -*- coding: utf-8 -*- -# © 2016 Antiun Ingeniería S.L. - Jairo Llopis -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -from . import mail diff --git a/mail_debrand/models/mail.py b/mail_debrand/models/mail.py deleted file mode 100644 index d28960ff..00000000 --- a/mail_debrand/models/mail.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# © 2016 Antiun Ingeniería S.L. - Jairo Llopis -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -from openerp import _, api, models, tools - - -class MailNotification(models.Model): - _inherit = "mail.notification" - - @api.model - def _get_signature_footer(self, user_id, res_model=None, res_id=None, - user_signature=True): - """Generate signature footer only with the chosen parts. - - Now, you can set ``skip_signature_user=True`` in the context to remove - the user signature (it's the same as ``user_signature=False``), and - ``skip_signature_company=True`` to remove the company's. - """ - user = self.env["res.users"].browse(user_id) - parts = list() - - if user_signature and not self.env.context.get("skip_signature_user"): - parts.append(self._get_signature_footer_user(user)) - - if not self.env.context.get("skip_signature_company"): - parts.append(self._get_signature_footer_company(user)) - - footer = "" - for part in parts: - footer = tools.append_content_to_html( - footer, part, plaintext=False) - - return footer - - @api.model - def _get_signature_footer_user(self, user): - """User part of the signature.""" - return user.signature if user.signature else "--
%s" % user.name - - def _get_signature_footer_company(self, user): - """Company part of the signature.""" - website = user.company_id.website - if website: - if not website.startswith(('http:', 'https:')): - website = "http://" + website - company = ("%s" % - (website, user.company_id.name)) - else: - company = user.company_id.name - return _('Sent by %s') % company diff --git a/mail_debrand/tests/__init__.py b/mail_debrand/tests/__init__.py deleted file mode 100644 index 992b8166..00000000 --- a/mail_debrand/tests/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# -*- coding: utf-8 -*- -# © 2016 Antiun Ingeniería S.L. - Jairo Llopis -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -from . import test_mail diff --git a/mail_debrand/tests/test_mail.py b/mail_debrand/tests/test_mail.py deleted file mode 100644 index b98d19a7..00000000 --- a/mail_debrand/tests/test_mail.py +++ /dev/null @@ -1,71 +0,0 @@ -# -*- coding: utf-8 -*- -# © 2016 Antiun Ingeniería S.L. - Jairo Llopis -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -from openerp.tests.common import TransactionCase - - -class SignatureCase(TransactionCase): - def setUp(self): - super(SignatureCase, self).setUp() - self.user = self.env.ref("base.user_demo").with_context(lang="en_US") - self.mail_notification = self.env["mail.notification"].with_context( - lang="en_US") - - def signature(self, **context): - """Get user's signature.""" - return (self.mail_notification.with_context(**context) - ._get_signature_footer(self.user.id)) - - def test_signature_user_custom(self): - """User name does not appear in signature when it is custom.""" - self.user.signature = u"¡Cüstom!" - signature = self.signature() - self.assertNotIn(self.user.name, signature) - - def test_signature_user_empty(self): - """User name appears in signature by default.""" - self.user.signature = False - signature = self.signature() - self.assertIn(self.user.name, signature) - - def test_signature_user_skip(self): - """User signature is skipped.""" - self.user.signature = "Skip me." - signature = self.signature(skip_signature_user=True) - self.assertNotIn(self.user.signature, signature) - - def test_signature_company_website_custom(self): - """Company website link appears in signature.""" - sites = ( - "HTTP://EXAMPLE.COM", - "http://example.com", - "https://example.com", - "HTTPS://example.com," - ) - for site in sites: - for url in (site, site[8:]): - self.user.company_id.website = url - signature = self.signature() - self.assertIn(url, signature) - self.assertIn(self.user.company_id.name, signature) - - def test_signature_company_website_empty(self): - """Company website link does not appear in signature.""" - self.user.company_id.website = False - signature = self.signature() - self.assertNotIn("