From d5a677dd55ce7ffc4398e49f02f20b00ca08fa00 Mon Sep 17 00:00:00 2001 From: "teodoralexandru@nexterp.ro" Date: Tue, 12 Jan 2021 11:41:58 +0200 Subject: [PATCH] also precommit --- mail_debrand/__manifest__.py | 10 ++- mail_debrand/models/__init__.py | 3 +- mail_debrand/models/mail_render_mixin.py | 78 ++++++++++++++++++++++++ 3 files changed, 87 insertions(+), 4 deletions(-) create mode 100644 mail_debrand/models/mail_render_mixin.py diff --git a/mail_debrand/__manifest__.py b/mail_debrand/__manifest__.py index 4081274..b9eeb28 100644 --- a/mail_debrand/__manifest__.py +++ b/mail_debrand/__manifest__.py @@ -2,15 +2,21 @@ # Copyright 2017 Tecnativa - Pedro M. Baeza # Copyright 2019 Eficent Business and IT Consulting Services S.L. # - Lois Rilo +# 2020 NextERP Romania # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { "name": "Mail Debrand", - "summary": "Remove Odoo branding in sent emails", + "summary": """Remove Odoo branding in sent emails + Removes anchor 20characters + """, "version": "14.0.1.0.0", "category": "Social Network", "website": "https://github.com/OCA/social", - "author": "Tecnativa, Eficent, Onestein, Sodexis, Odoo Community Association (OCA)", + "author": """Tecnativa, Eficent, Onestein, Sodexis, Nexterp Romania, + Odoo Community Association (OCA)""", "license": "AGPL-3", "installable": True, "depends": ["mail"], diff --git a/mail_debrand/models/__init__.py b/mail_debrand/models/__init__.py index 89e090b..c385ac4 100644 --- a/mail_debrand/models/__init__.py +++ b/mail_debrand/models/__init__.py @@ -1,2 +1 @@ -from . import mail_template -from . import mail_thread +from . import mail_render_mixin diff --git a/mail_debrand/models/mail_render_mixin.py b/mail_debrand/models/mail_render_mixin.py new file mode 100644 index 0000000..20a97f5 --- /dev/null +++ b/mail_debrand/models/mail_render_mixin.py @@ -0,0 +1,78 @@ +# Copyright 2019 O4SB - Graeme Gellatly +# Copyright 2019 Tecnativa - Ernesto Tejeda +# Copyright 2020 Onestein - Andrea Stirpe +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +import re + +from lxml import etree + +from odoo import api, models + + +class MailRenderMixin(models.AbstractModel): + _inherit = "mail.render.mixin" + + @api.model + def _render_template( + self, + template_src, + model, + res_ids, + engine="jinja", + add_context=None, + post_process=False, + ): + """replace anything that is with odoo in templates + if is a