diff --git a/mail_debrand/README.rst b/mail_debrand/README.rst new file mode 100644 index 000000000..d1384c3f6 --- /dev/null +++ b/mail_debrand/README.rst @@ -0,0 +1,99 @@ +============ +Mail Debrand +============ + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge2| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github + :target: https://github.com/OCA/social/tree/12.0/mail_debrand + :alt: OCA/social +.. |badge3| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/social-12-0/social-12-0-mail_debrand + :alt: Translate me on Weblate +.. |badge4| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/205/12.0 + :alt: Try me on Runbot + +|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' + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +To use this module, you need to: + +* Install it. +* Send an email. +* Nobody will know it comes from Odoo. + +Changelog +========= + +12.0.1.0.0 (2018-11-06) +~~~~~~~~~~~~~~~~~~~~~~~ + +* [NEW] Initial V12 version. Complete rewrite from v11. + +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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Tecnativa +* Eficent + +Contributors +~~~~~~~~~~~~ + +* Pedro M. Baeza +* Lois Rilo +* Graeme Gellatly + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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. + +.. |maintainer-pedrobaeza| image:: https://github.com/pedrobaeza.png?size=40px + :target: https://github.com/pedrobaeza + :alt: pedrobaeza + +Current `maintainer `__: + +|maintainer-pedrobaeza| + +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/__init__.py b/mail_debrand/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/mail_debrand/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/mail_debrand/__manifest__.py b/mail_debrand/__manifest__.py new file mode 100644 index 000000000..2b3da82da --- /dev/null +++ b/mail_debrand/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright 2016 Tecnativa - Jairo Llopis +# Copyright 2017 Tecnativa - Pedro M. Baeza +# Copyright 2019 Eficent Business and IT Consulting Services S.L. +# - Lois Rilo +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +{ + "name": "Mail Debrand", + "summary": "Remove Odoo branding in sent emails", + "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"], + "development_status": "Stable", + "maintainers": ["pedrobaeza"], +} diff --git a/mail_debrand/i18n/fr.po b/mail_debrand/i18n/fr.po new file mode 100644 index 000000000..5c6b17e73 --- /dev/null +++ b/mail_debrand/i18n/fr.po @@ -0,0 +1,43 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_debrand +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" + +#. module: mail_debrand +#: model:ir.model,name:mail_debrand.model_mail_template +msgid "Email Templates" +msgstr "" + +#. module: mail_debrand +#: model:ir.model,name:mail_debrand.model_mail_thread +msgid "Email Thread" +msgstr "" + +#. module: mail_debrand +#: code:addons/mail_debrand/models/mail_template.py:15 +#, python-format +msgid "Odoo" +msgstr "" + +#. module: mail_debrand +#: code:addons/mail_debrand/models/mail_template.py:19 +#, python-format +msgid "Powered by" +msgstr "" + +#. module: mail_debrand +#: code:addons/mail_debrand/models/mail_template.py:14 +#, python-format +msgid "using" +msgstr "" diff --git a/mail_debrand/i18n/mail_debrand.pot b/mail_debrand/i18n/mail_debrand.pot new file mode 100644 index 000000000..123883d35 --- /dev/null +++ b/mail_debrand/i18n/mail_debrand.pot @@ -0,0 +1,43 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_debrand +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \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: mail_debrand +#: model:ir.model,name:mail_debrand.model_mail_template +msgid "Email Templates" +msgstr "" + +#. module: mail_debrand +#: model:ir.model,name:mail_debrand.model_mail_thread +msgid "Email Thread" +msgstr "" + +#. module: mail_debrand +#: code:addons/mail_debrand/models/mail_template.py:15 +#, python-format +msgid "Odoo" +msgstr "" + +#. module: mail_debrand +#: code:addons/mail_debrand/models/mail_template.py:19 +#, python-format +msgid "Powered by" +msgstr "" + +#. module: mail_debrand +#: code:addons/mail_debrand/models/mail_template.py:14 +#, python-format +msgid "using" +msgstr "" + diff --git a/mail_debrand/i18n/pt.po b/mail_debrand/i18n/pt.po new file mode 100644 index 000000000..3d50ad0fe --- /dev/null +++ b/mail_debrand/i18n/pt.po @@ -0,0 +1,45 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_debrand +# +msgid "" +msgstr "" +"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" +"Language-Team: none\n" +"Language: pt\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 3.10\n" + +#. module: mail_debrand +#: model:ir.model,name:mail_debrand.model_mail_template +msgid "Email Templates" +msgstr "Modelos de Email" + +#. module: mail_debrand +#: model:ir.model,name:mail_debrand.model_mail_thread +msgid "Email Thread" +msgstr "Thread do email" + +#. module: mail_debrand +#: code:addons/mail_debrand/models/mail_template.py:15 +#, python-format +msgid "Odoo" +msgstr "" + +#. module: mail_debrand +#: code:addons/mail_debrand/models/mail_template.py:19 +#, python-format +msgid "Powered by" +msgstr "" + +#. module: mail_debrand +#: code:addons/mail_debrand/models/mail_template.py:14 +#, python-format +msgid "using" +msgstr "" diff --git a/mail_debrand/i18n/sl.po b/mail_debrand/i18n/sl.po new file mode 100644 index 000000000..4b041eb72 --- /dev/null +++ b/mail_debrand/i18n/sl.po @@ -0,0 +1,46 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_debrand +# +msgid "" +msgstr "" +"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" +"Language-Team: none\n" +"Language: sl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=4; plural=n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || " +"n%100==4 ? 2 : 3;\n" +"X-Generator: Weblate 3.10\n" + +#. module: mail_debrand +#: model:ir.model,name:mail_debrand.model_mail_template +msgid "Email Templates" +msgstr "Predloge e-pošte" + +#. module: mail_debrand +#: model:ir.model,name:mail_debrand.model_mail_thread +msgid "Email Thread" +msgstr "E-poštna nit" + +#. module: mail_debrand +#: code:addons/mail_debrand/models/mail_template.py:15 +#, python-format +msgid "Odoo" +msgstr "Odoo" + +#. module: mail_debrand +#: code:addons/mail_debrand/models/mail_template.py:19 +#, python-format +msgid "Powered by" +msgstr "Powered by" + +#. module: mail_debrand +#: code:addons/mail_debrand/models/mail_template.py:14 +#, python-format +msgid "using" +msgstr "z uporabo" diff --git a/mail_debrand/i18n/sr_Latn.po b/mail_debrand/i18n/sr_Latn.po new file mode 100644 index 000000000..599e97fc0 --- /dev/null +++ b/mail_debrand/i18n/sr_Latn.po @@ -0,0 +1,44 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_debrand +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: sr_Latn\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=" +"4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" + +#. module: mail_debrand +#: model:ir.model,name:mail_debrand.model_mail_template +msgid "Email Templates" +msgstr "" + +#. module: mail_debrand +#: model:ir.model,name:mail_debrand.model_mail_thread +msgid "Email Thread" +msgstr "" + +#. module: mail_debrand +#: code:addons/mail_debrand/models/mail_template.py:15 +#, python-format +msgid "Odoo" +msgstr "" + +#. module: mail_debrand +#: code:addons/mail_debrand/models/mail_template.py:19 +#, python-format +msgid "Powered by" +msgstr "" + +#. module: mail_debrand +#: code:addons/mail_debrand/models/mail_template.py:14 +#, python-format +msgid "using" +msgstr "" diff --git a/mail_debrand/models/__init__.py b/mail_debrand/models/__init__.py new file mode 100644 index 000000000..89e090b24 --- /dev/null +++ b/mail_debrand/models/__init__.py @@ -0,0 +1,2 @@ +from . import mail_template +from . import mail_thread diff --git a/mail_debrand/models/mail_template.py b/mail_debrand/models/mail_template.py new file mode 100644 index 000000000..eaa32870b --- /dev/null +++ b/mail_debrand/models/mail_template.py @@ -0,0 +1,40 @@ +# Copyright 2019 O4SB - Graeme Gellatly +# Copyright 2019 Tecnativa - Ernesto Tejeda +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +import re + +from lxml import html as htmltree + +from odoo import _, api, models + + +class MailTemplate(models.Model): + _inherit = "mail.template" + + @api.model + def _debrand_body(self, 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) + for elem in powered_by_elements: + # make sure it isn't a spurious powered by + if any( + [ + "www.odoo.com" in child.get("href", "") + for child in elem.getchildren() + ] + ): + for child in elem.getchildren(): + elem.remove(child) + elem.text = None + return htmltree.tostring(root).decode("utf-8") + + @api.model + def render_post_process(self, html): + html = super().render_post_process(html) + return self._debrand_body(html) diff --git a/mail_debrand/models/mail_thread.py b/mail_debrand/models/mail_thread.py new file mode 100644 index 000000000..7fc6f0a2a --- /dev/null +++ b/mail_debrand/models/mail_thread.py @@ -0,0 +1,14 @@ +# Copyright 2019 Eficent Business and IT Consulting Services S.L. +# Lois Rilo +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import models + + +class MailThread(models.AbstractModel): + _inherit = "mail.thread" + + def _replace_local_links(self, html, base_url=None): + html = super()._replace_local_links(html, base_url=base_url) + html_debranded = self.env["mail.template"]._debrand_body(html) + return html_debranded diff --git a/mail_debrand/readme/CONTRIBUTORS.rst b/mail_debrand/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..b5f7ce79c --- /dev/null +++ b/mail_debrand/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* Pedro M. Baeza +* Lois Rilo +* Graeme Gellatly diff --git a/mail_debrand/readme/DESCRIPTION.rst b/mail_debrand/readme/DESCRIPTION.rst new file mode 100644 index 000000000..51b2b495d --- /dev/null +++ b/mail_debrand/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module modifies the functionality of emails to remove the Odoo branding, +specifically the 'using Odoo' of notifications or the 'Powered by Odoo' diff --git a/mail_debrand/readme/HISTORY.rst b/mail_debrand/readme/HISTORY.rst new file mode 100644 index 000000000..ad209cc2e --- /dev/null +++ b/mail_debrand/readme/HISTORY.rst @@ -0,0 +1,4 @@ +12.0.1.0.0 (2018-11-06) +~~~~~~~~~~~~~~~~~~~~~~~ + +* [NEW] Initial V12 version. Complete rewrite from v11. diff --git a/mail_debrand/readme/USAGE.rst b/mail_debrand/readme/USAGE.rst new file mode 100644 index 000000000..2a57dc018 --- /dev/null +++ b/mail_debrand/readme/USAGE.rst @@ -0,0 +1,5 @@ +To use this module, you need to: + +* Install it. +* Send an email. +* Nobody will know it comes from Odoo. diff --git a/mail_debrand/static/description/icon.png b/mail_debrand/static/description/icon.png new file mode 100644 index 000000000..06a30af91 Binary files /dev/null and b/mail_debrand/static/description/icon.png differ diff --git a/mail_debrand/static/description/icon.svg b/mail_debrand/static/description/icon.svg new file mode 100644 index 000000000..6609694df --- /dev/null +++ b/mail_debrand/static/description/icon.svg @@ -0,0 +1,248 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mail_debrand/static/description/index.html b/mail_debrand/static/description/index.html new file mode 100644 index 000000000..53308184e --- /dev/null +++ b/mail_debrand/static/description/index.html @@ -0,0 +1,448 @@ + + + + + + +Mail Debrand + + + +
+

Mail Debrand

+ + +

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

+ +
+

Usage

+

To use this module, you need to:

+
    +
  • Install it.
  • +
  • Send an email.
  • +
  • Nobody will know it comes from Odoo.
  • +
+
+
+

Changelog

+
+

12.0.1.0.0 (2018-11-06)

+
    +
  • [NEW] Initial V12 version. Complete rewrite from v11.
  • +
+
+
+
+

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.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Tecnativa
  • +
  • Eficent
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

Current maintainer:

+

pedrobaeza

+

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/__init__.py b/mail_debrand/tests/__init__.py new file mode 100644 index 000000000..e7ef9cb49 --- /dev/null +++ b/mail_debrand/tests/__init__.py @@ -0,0 +1 @@ +from . import test_mail_debrand diff --git a/mail_debrand/tests/test_mail_debrand.py b/mail_debrand/tests/test_mail_debrand.py new file mode 100644 index 000000000..776719cf4 --- /dev/null +++ b/mail_debrand/tests/test_mail_debrand.py @@ -0,0 +1,21 @@ +# Copyright 2017 Tecnativa - Pedro M. Baeza +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +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 + + def test_default_debrand(self): + self.assertIn("using", self.default_arch) + res = self.env["mail.template"]._debrand_body(self.default_arch) + self.assertNotIn("using", res) + + def test_paynow_debrand(self): + self.assertIn("Powered by", self.paynow_arch) + res = self.env["mail.template"]._debrand_body(self.paynow_arch) + self.assertNotIn("Powered by", res)