Files
Odoo-18.0-20251222/report_substitute/models/mail_thread.py
tocmo0nlord adbe430761
Some checks failed
pre-commit / pre-commit (push) Has been cancelled
tests / Detect unreleased dependencies (push) Has been cancelled
tests / test with OCB (push) Has been cancelled
tests / test with Odoo (push) Has been cancelled
Initial commit: Odoo 18.0-20251222 extra-addons
2026-03-13 20:43:25 +00:00

44 lines
1.3 KiB
Python

# Copyright 2019 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models
class MailThread(models.AbstractModel):
_inherit = "mail.thread"
def message_post_with_source(
self,
source_ref,
render_values=None,
message_type="notification",
subtype_xmlid=False,
subtype_id=False,
**kwargs,
):
template, view = self._get_source_from_ref(source_ref)
if template and template.report_template_ids and self.ids:
new_report_template_ids = [
report.get_substitution_report(self.ids).id
for report in template.report_template_ids
]
return super(
MailThread,
self.with_context(default_report_template_ids=new_report_template_ids),
).message_post_with_source(
source_ref,
render_values,
message_type,
subtype_xmlid,
subtype_id,
**kwargs,
)
return super().message_post_with_source(
source_ref,
render_values,
message_type,
subtype_xmlid,
subtype_id,
**kwargs,
)