[IMP] mail_debrand: Avoid process each created mail

This commit is contained in:
Ioan Galan 2021-07-27 15:56:31 +02:00 committed by AlvaroTForgeFlow
parent d3c59ddf74
commit f04051ddcb

View File

@ -2,23 +2,14 @@
# Copyright 2019 Tecnativa - Ernesto Tejeda # Copyright 2019 Tecnativa - Ernesto Tejeda
# Copyright 2020 Onestein - Andrea Stirpe # Copyright 2020 Onestein - Andrea Stirpe
# 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 odoo import api, models from odoo import models
class MailMail(models.AbstractModel): class MailMail(models.AbstractModel):
_inherit = "mail.mail" _inherit = "mail.mail"
# in messages from objects is adding using Odoo that we are going to remove def _send_prepare_body(self):
body = super()._send_prepare_body()
@api.model_create_multi return self.env["mail.render.mixin"].remove_href_odoo(
def create(self, values_list): body or "", remove_parent=0, remove_before=1
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)