[MIG] mail_debrand: Migration to v13.0
This commit is contained in:
parent
1143e4226c
commit
f15c2638ca
@ -20,7 +20,7 @@ Mail Debrand
|
|||||||
:target: https://runbot.odoo-community.org/runbot/205/12.0
|
:target: https://runbot.odoo-community.org/runbot/205/12.0
|
||||||
:alt: Try me on Runbot
|
: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,
|
This module modifies the functionality of emails to remove the Odoo branding,
|
||||||
specifically the 'using Odoo' of notifications or the 'Powered by Odoo'
|
specifically the 'using Odoo' of notifications or the 'Powered by Odoo'
|
||||||
@ -92,7 +92,7 @@ promote its widespread use.
|
|||||||
|
|
||||||
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|
||||||
|
|
||||||
|maintainer-pedrobaeza|
|
|maintainer-pedrobaeza|
|
||||||
|
|
||||||
This module is part of the `OCA/social <https://github.com/OCA/social/tree/12.0/mail_debrand>`_ project on GitHub.
|
This module is part of the `OCA/social <https://github.com/OCA/social/tree/12.0/mail_debrand>`_ project on GitHub.
|
||||||
|
|
||||||
|
@ -7,15 +7,13 @@
|
|||||||
{
|
{
|
||||||
"name": "Mail Debrand",
|
"name": "Mail Debrand",
|
||||||
"summary": "Remove Odoo branding in sent emails",
|
"summary": "Remove Odoo branding in sent emails",
|
||||||
"version": "12.0.2.0.1",
|
"version": "13.0.0.0.1",
|
||||||
"category": "Social Network",
|
"category": "Social Network",
|
||||||
"website": "https://github.com/OCA/social/",
|
"website": "https://github.com/OCA/social/",
|
||||||
"author": "Tecnativa, Eficent, Odoo Community Association (OCA)",
|
"author": "Tecnativa, Eficent, Odoo Community Association (OCA)",
|
||||||
"license": "AGPL-3",
|
"license": "AGPL-3",
|
||||||
"installable": True,
|
"installable": True,
|
||||||
"depends": [
|
"depends": ["mail"],
|
||||||
"mail",
|
|
||||||
],
|
|
||||||
"development_status": "Stable",
|
"development_status": "Stable",
|
||||||
"maintainers": ["pedrobaeza"],
|
"maintainers": ["pedrobaeza"],
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#
|
#
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Odoo Server 12.0\n"
|
"Project-Id-Version: Odoo Server 13.0\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"Last-Translator: Automatically generated\n"
|
"Last-Translator: Automatically generated\n"
|
||||||
"Language-Team: none\n"
|
"Language-Team: none\n"
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#
|
#
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Odoo Server 12.0\n"
|
"Project-Id-Version: Odoo Server 13.0\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"Last-Translator: <>\n"
|
"Last-Translator: <>\n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#
|
#
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Odoo Server 12.0\n"
|
"Project-Id-Version: Odoo Server 13.0\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"PO-Revision-Date: 2020-03-02 17:13+0000\n"
|
"PO-Revision-Date: 2020-03-02 17:13+0000\n"
|
||||||
"Last-Translator: Pedro Castro Silva <pedrocs@exo.pt>\n"
|
"Last-Translator: Pedro Castro Silva <pedrocs@exo.pt>\n"
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#
|
#
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Odoo Server 12.0\n"
|
"Project-Id-Version: Odoo Server 13.0\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"PO-Revision-Date: 2020-03-19 10:13+0000\n"
|
"PO-Revision-Date: 2020-03-19 10:13+0000\n"
|
||||||
"Last-Translator: Matjaz Mozetic <matjaz@matmoz.si>\n"
|
"Last-Translator: Matjaz Mozetic <matjaz@matmoz.si>\n"
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#
|
#
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Odoo Server 12.0\n"
|
"Project-Id-Version: Odoo Server 13.0\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"Last-Translator: Automatically generated\n"
|
"Last-Translator: Automatically generated\n"
|
||||||
"Language-Team: none\n"
|
"Language-Team: none\n"
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
# Copyright 2019 O4SB - Graeme Gellatly
|
# Copyright 2019 O4SB - Graeme Gellatly
|
||||||
# Copyright 2019 Tecnativa - Ernesto Tejeda
|
# Copyright 2019 Tecnativa - Ernesto Tejeda
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||||
from lxml import html as htmltree
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
from lxml import html as htmltree
|
||||||
|
|
||||||
from odoo import _, api, models
|
from odoo import _, api, models
|
||||||
|
|
||||||
|
|
||||||
@ -11,18 +13,14 @@ class MailTemplate(models.Model):
|
|||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _debrand_body(self, html):
|
def _debrand_body(self, html):
|
||||||
using_word = _('using')
|
using_word = _("using")
|
||||||
odoo_word = _('Odoo')
|
odoo_word = _("Odoo")
|
||||||
html = re.sub(
|
html = re.sub(using_word + "(.*)[\r\n]*(.*)>" + odoo_word + r"</a>", "", html)
|
||||||
using_word + "(.*)[\r\n]*(.*)>" + odoo_word + r"</a>", "", html,
|
|
||||||
)
|
|
||||||
powered_by = _("Powered by")
|
powered_by = _("Powered by")
|
||||||
if powered_by not in html:
|
if powered_by not in html:
|
||||||
return html
|
return html
|
||||||
root = htmltree.fromstring(html)
|
root = htmltree.fromstring(html)
|
||||||
powered_by_elements = root.xpath(
|
powered_by_elements = root.xpath("//*[text()[contains(.,'%s')]]" % powered_by)
|
||||||
"//*[text()[contains(.,'%s')]]" % powered_by
|
|
||||||
)
|
|
||||||
for elem in powered_by_elements:
|
for elem in powered_by_elements:
|
||||||
# make sure it isn't a spurious powered by
|
# make sure it isn't a spurious powered by
|
||||||
if any(
|
if any(
|
||||||
|
@ -367,7 +367,7 @@ ul.auto-toc {
|
|||||||
!! This file is generated by oca-gen-addon-readme !!
|
!! This file is generated by oca-gen-addon-readme !!
|
||||||
!! changes will be overwritten. !!
|
!! changes will be overwritten. !!
|
||||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||||
<p><a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/social/tree/12.0/mail_debrand"><img alt="OCA/social" src="https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/social-12-0/social-12-0-mail_debrand"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/205/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
<p><a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/social/tree/13.0/mail_debrand"><img alt="OCA/social" src="https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/social-13-0/social-13-0-mail_debrand"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/205/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||||
<p>This module modifies the functionality of emails to remove the Odoo branding,
|
<p>This module modifies the functionality of emails to remove the Odoo branding,
|
||||||
specifically the ‘using Odoo’ of notifications or the ‘Powered by Odoo’</p>
|
specifically the ‘using Odoo’ of notifications or the ‘Powered by Odoo’</p>
|
||||||
<p><strong>Table of contents</strong></p>
|
<p><strong>Table of contents</strong></p>
|
||||||
@ -410,7 +410,7 @@ specifically the ‘using Odoo’ of notifications or the ‘Powered by Odoo’<
|
|||||||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/social/issues">GitHub Issues</a>.
|
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/social/issues">GitHub Issues</a>.
|
||||||
In case of trouble, please check there if your issue has already been reported.
|
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
|
If you spotted it first, help us smashing it by providing a detailed and welcomed
|
||||||
<a class="reference external" href="https://github.com/OCA/social/issues/new?body=module:%20mail_debrand%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
<a class="reference external" href="https://github.com/OCA/social/issues/new?body=module:%20mail_debrand%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||||
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="credits">
|
<div class="section" id="credits">
|
||||||
@ -439,7 +439,7 @@ mission is to support the collaborative development of Odoo features and
|
|||||||
promote its widespread use.</p>
|
promote its widespread use.</p>
|
||||||
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
|
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
|
||||||
<p><a class="reference external" href="https://github.com/pedrobaeza"><img alt="pedrobaeza" src="https://github.com/pedrobaeza.png?size=40px" /></a></p>
|
<p><a class="reference external" href="https://github.com/pedrobaeza"><img alt="pedrobaeza" src="https://github.com/pedrobaeza.png?size=40px" /></a></p>
|
||||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/12.0/mail_debrand">OCA/social</a> project on GitHub.</p>
|
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/13.0/mail_debrand">OCA/social</a> project on GitHub.</p>
|
||||||
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -7,19 +7,15 @@ from odoo.tests import common
|
|||||||
class TestMailDebrand(common.TransactionCase):
|
class TestMailDebrand(common.TransactionCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super().setUp()
|
super().setUp()
|
||||||
self.default_arch = self.env.ref(
|
self.default_arch = self.env.ref("mail.message_notification_email").arch
|
||||||
'mail.message_notification_email'
|
self.paynow_arch = self.env.ref("mail.mail_notification_paynow").arch
|
||||||
).arch
|
|
||||||
self.paynow_arch = self.env.ref(
|
|
||||||
'mail.mail_notification_paynow'
|
|
||||||
).arch
|
|
||||||
|
|
||||||
def test_default_debrand(self):
|
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)
|
res = self.env["mail.template"]._debrand_body(self.default_arch)
|
||||||
self.assertNotIn('using', res)
|
self.assertNotIn("using", res)
|
||||||
|
|
||||||
def test_paynow_debrand(self):
|
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)
|
res = self.env["mail.template"]._debrand_body(self.paynow_arch)
|
||||||
self.assertNotIn('Powered by', res)
|
self.assertNotIn("Powered by", res)
|
||||||
|
Loading…
Reference in New Issue
Block a user