[13.0][MIG] - report_substitute migration

This commit is contained in:
sbejaoui
2020-11-06 11:25:04 +01:00
committed by matiasperalta1
parent 8b9266dffe
commit 0f17d279e2
11 changed files with 136 additions and 144 deletions

View File

@@ -1,23 +1,20 @@
# Copyright 2019 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, models
from odoo import models
class MailThread(models.AbstractModel):
_inherit = 'mail.thread'
_inherit = "mail.thread"
@api.multi
def message_post_with_template(self, template_id, **kwargs):
template = self.env['mail.template'].browse(template_id)
template = self.env["mail.template"].browse(template_id)
old_report = False
if template and template.report_template and self.ids:
active_ids = self.ids
old_report = template.report_template
template.report_template = old_report.get_substitution_report(
active_ids
)
template.report_template = old_report.get_substitution_report(active_ids)
res = super().message_post_with_template(template_id, **kwargs)
if old_report:
template.report_template = old_report