From f15c2638ca0f080ae45f83612057136df7a661fd Mon Sep 17 00:00:00 2001 From: Valentin Vinagre Urteaga Date: Fri, 20 Mar 2020 16:15:04 +0100 Subject: [PATCH] [MIG] mail_debrand: Migration to v13.0 --- mail_debrand/README.rst | 4 ++-- mail_debrand/__manifest__.py | 6 ++---- mail_debrand/i18n/fr.po | 2 +- mail_debrand/i18n/mail_debrand.pot | 2 +- mail_debrand/i18n/pt.po | 2 +- mail_debrand/i18n/sl.po | 2 +- mail_debrand/i18n/sr_Latn.po | 2 +- mail_debrand/models/mail_template.py | 16 +++++++--------- mail_debrand/static/description/index.html | 6 +++--- mail_debrand/tests/test_mail_debrand.py | 16 ++++++---------- 10 files changed, 25 insertions(+), 33 deletions(-) diff --git a/mail_debrand/README.rst b/mail_debrand/README.rst index cdbf04b..d1384c3 100644 --- a/mail_debrand/README.rst +++ b/mail_debrand/README.rst @@ -20,7 +20,7 @@ Mail Debrand :target: https://runbot.odoo-community.org/runbot/205/12.0 :alt: Try me on Runbot -|badge1| |badge2| |badge3| |badge4| +|badge1| |badge2| |badge3| |badge4| This module modifies the functionality of emails to remove the Odoo branding, specifically the 'using Odoo' of notifications or the 'Powered by Odoo' @@ -92,7 +92,7 @@ promote its widespread use. Current `maintainer `__: -|maintainer-pedrobaeza| +|maintainer-pedrobaeza| This module is part of the `OCA/social `_ project on GitHub. diff --git a/mail_debrand/__manifest__.py b/mail_debrand/__manifest__.py index f0cd93d..2b3da82 100644 --- a/mail_debrand/__manifest__.py +++ b/mail_debrand/__manifest__.py @@ -7,15 +7,13 @@ { "name": "Mail Debrand", "summary": "Remove Odoo branding in sent emails", - "version": "12.0.2.0.1", + "version": "13.0.0.0.1", "category": "Social Network", "website": "https://github.com/OCA/social/", "author": "Tecnativa, Eficent, Odoo Community Association (OCA)", "license": "AGPL-3", "installable": True, - "depends": [ - "mail", - ], + "depends": ["mail"], "development_status": "Stable", "maintainers": ["pedrobaeza"], } diff --git a/mail_debrand/i18n/fr.po b/mail_debrand/i18n/fr.po index 17c73d3..5c6b17e 100644 --- a/mail_debrand/i18n/fr.po +++ b/mail_debrand/i18n/fr.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 12.0\n" +"Project-Id-Version: Odoo Server 13.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" diff --git a/mail_debrand/i18n/mail_debrand.pot b/mail_debrand/i18n/mail_debrand.pot index c4440e3..123883d 100644 --- a/mail_debrand/i18n/mail_debrand.pot +++ b/mail_debrand/i18n/mail_debrand.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 12.0\n" +"Project-Id-Version: Odoo Server 13.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: <>\n" "Language-Team: \n" diff --git a/mail_debrand/i18n/pt.po b/mail_debrand/i18n/pt.po index ed73f73..3d50ad0 100644 --- a/mail_debrand/i18n/pt.po +++ b/mail_debrand/i18n/pt.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 12.0\n" +"Project-Id-Version: Odoo Server 13.0\n" "Report-Msgid-Bugs-To: \n" "PO-Revision-Date: 2020-03-02 17:13+0000\n" "Last-Translator: Pedro Castro Silva \n" diff --git a/mail_debrand/i18n/sl.po b/mail_debrand/i18n/sl.po index 6ed0238..4b041eb 100644 --- a/mail_debrand/i18n/sl.po +++ b/mail_debrand/i18n/sl.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 12.0\n" +"Project-Id-Version: Odoo Server 13.0\n" "Report-Msgid-Bugs-To: \n" "PO-Revision-Date: 2020-03-19 10:13+0000\n" "Last-Translator: Matjaz Mozetic \n" diff --git a/mail_debrand/i18n/sr_Latn.po b/mail_debrand/i18n/sr_Latn.po index 6e1c920..599e97f 100644 --- a/mail_debrand/i18n/sr_Latn.po +++ b/mail_debrand/i18n/sr_Latn.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 12.0\n" +"Project-Id-Version: Odoo Server 13.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" diff --git a/mail_debrand/models/mail_template.py b/mail_debrand/models/mail_template.py index 0525f4f..eaa3287 100644 --- a/mail_debrand/models/mail_template.py +++ b/mail_debrand/models/mail_template.py @@ -1,8 +1,10 @@ # Copyright 2019 O4SB - Graeme Gellatly # Copyright 2019 Tecnativa - Ernesto Tejeda # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from lxml import html as htmltree import re + +from lxml import html as htmltree + from odoo import _, api, models @@ -11,18 +13,14 @@ class MailTemplate(models.Model): @api.model def _debrand_body(self, html): - using_word = _('using') - odoo_word = _('Odoo') - html = re.sub( - using_word + "(.*)[\r\n]*(.*)>" + odoo_word + r"", "", html, - ) + using_word = _("using") + odoo_word = _("Odoo") + html = re.sub(using_word + "(.*)[\r\n]*(.*)>" + odoo_word + r"", "", html) powered_by = _("Powered by") if powered_by not in html: return html root = htmltree.fromstring(html) - powered_by_elements = root.xpath( - "//*[text()[contains(.,'%s')]]" % powered_by - ) + powered_by_elements = root.xpath("//*[text()[contains(.,'%s')]]" % powered_by) for elem in powered_by_elements: # make sure it isn't a spurious powered by if any( diff --git a/mail_debrand/static/description/index.html b/mail_debrand/static/description/index.html index 314a775..5330818 100644 --- a/mail_debrand/static/description/index.html +++ b/mail_debrand/static/description/index.html @@ -367,7 +367,7 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

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

+

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

This module modifies the functionality of emails to remove the Odoo branding, specifically the ‘using Odoo’ of notifications or the ‘Powered by Odoo’

Table of contents

@@ -410,7 +410,7 @@ specifically the ‘using Odoo’ of notifications or the ‘Powered by Odoo’<

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.

+feedback.

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

@@ -439,7 +439,7 @@ mission is to support the collaborative development of Odoo features and promote its widespread use.

Current maintainer:

pedrobaeza

-

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

+

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

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

diff --git a/mail_debrand/tests/test_mail_debrand.py b/mail_debrand/tests/test_mail_debrand.py index 517d3f3..776719c 100644 --- a/mail_debrand/tests/test_mail_debrand.py +++ b/mail_debrand/tests/test_mail_debrand.py @@ -7,19 +7,15 @@ from odoo.tests import common class TestMailDebrand(common.TransactionCase): def setUp(self): super().setUp() - self.default_arch = self.env.ref( - 'mail.message_notification_email' - ).arch - self.paynow_arch = self.env.ref( - 'mail.mail_notification_paynow' - ).arch + self.default_arch = self.env.ref("mail.message_notification_email").arch + self.paynow_arch = self.env.ref("mail.mail_notification_paynow").arch def test_default_debrand(self): - self.assertIn('using', self.default_arch) + self.assertIn("using", self.default_arch) res = self.env["mail.template"]._debrand_body(self.default_arch) - self.assertNotIn('using', res) + self.assertNotIn("using", res) def test_paynow_debrand(self): - self.assertIn('Powered by', self.paynow_arch) + self.assertIn("Powered by", self.paynow_arch) res = self.env["mail.template"]._debrand_body(self.paynow_arch) - self.assertNotIn('Powered by', res) + self.assertNotIn("Powered by", res)