[IMP] mail_debrand: Split code into model-specific files

This commit is contained in:
Ioan Galan 2021-07-22 13:19:23 +02:00 committed by AlvaroTForgeFlow
parent 42c4779078
commit aa00a02097
3 changed files with 26 additions and 20 deletions

View File

@ -1 +1,2 @@
from . import mail_render_mixinANDmail_mail from . import mail_render_mixin
from . import mail_mail

View File

@ -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)

View File

@ -88,22 +88,3 @@ class MailRenderMixin(models.AbstractModel):
orginal_rendered[key] = self.remove_href_odoo(orginal_rendered[key]) orginal_rendered[key] = self.remove_href_odoo(orginal_rendered[key])
return orginal_rendered 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)