diff --git a/mail_debrand/models/__init__.py b/mail_debrand/models/__init__.py index 0e99243..1532c75 100644 --- a/mail_debrand/models/__init__.py +++ b/mail_debrand/models/__init__.py @@ -1 +1,2 @@ -from . import mail_render_mixinANDmail_mail +from . import mail_render_mixin +from . import mail_mail diff --git a/mail_debrand/models/mail_mail.py b/mail_debrand/models/mail_mail.py new file mode 100644 index 0000000..c36a4ed --- /dev/null +++ b/mail_debrand/models/mail_mail.py @@ -0,0 +1,24 @@ +# 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). +from odoo import api, models + + +class MailMail(models.AbstractModel): + _inherit = "mail.mail" + + # in messages from objects is adding using Odoo that we are going to remove + + @api.model_create_multi + def create(self, values_list): + for index, _value in enumerate(values_list): + values_list[index]["body_html"] = self.env[ + "mail.render.mixin" + ].remove_href_odoo( + values_list[index].get("body_html", ""), + remove_parent=0, + remove_before=1, + ) + + return super().create(values_list) diff --git a/mail_debrand/models/mail_render_mixinANDmail_mail.py b/mail_debrand/models/mail_render_mixin.py similarity index 86% rename from mail_debrand/models/mail_render_mixinANDmail_mail.py rename to mail_debrand/models/mail_render_mixin.py index 01581c5..00524a5 100644 --- a/mail_debrand/models/mail_render_mixinANDmail_mail.py +++ b/mail_debrand/models/mail_render_mixin.py @@ -88,22 +88,3 @@ class MailRenderMixin(models.AbstractModel): orginal_rendered[key] = self.remove_href_odoo(orginal_rendered[key]) return orginal_rendered - - -class MailMail(models.AbstractModel): - _inherit = "mail.mail" - - # in messages from objects is adding using Odoo that we are going to remove - - @api.model_create_multi - def create(self, values_list): - for index, _value in enumerate(values_list): - values_list[index]["body_html"] = self.env[ - "mail.render.mixin" - ].remove_href_odoo( - values_list[index].get("body_html", ""), - remove_parent=0, - remove_before=1, - ) - - return super().create(values_list)