mirror of
https://github.com/OCA/reporting-engine.git
synced 2025-02-16 16:30:38 +02:00
[IMP] - manage substitution for mail.thread message_post_with_template
This commit is contained in:
1
report_substitute/wizards/__init__.py
Normal file
1
report_substitute/wizards/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import mail_compose_message
|
||||
28
report_substitute/wizards/mail_compose_message.py
Normal file
28
report_substitute/wizards/mail_compose_message.py
Normal file
@@ -0,0 +1,28 @@
|
||||
# Copyright 2019 ACSONE SA/NV
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import api, models
|
||||
|
||||
|
||||
class MailComposeMessage(models.TransientModel):
|
||||
|
||||
_inherit = 'mail.compose.message'
|
||||
|
||||
@api.multi
|
||||
@api.onchange('template_id')
|
||||
def onchange_template_id_wrapper(self):
|
||||
old_report_template = False
|
||||
if (
|
||||
self.template_id
|
||||
and self.template_id.report_template
|
||||
and self.env.context.get('active_ids')
|
||||
):
|
||||
active_ids = self.env.context.get('active_ids')
|
||||
old_report_template = self.template_id.report_template
|
||||
self.template_id.report_template = (
|
||||
old_report_template.get_substitution_report(active_ids)
|
||||
)
|
||||
res = super().onchange_template_id_wrapper()
|
||||
if old_report_template:
|
||||
self.template_id.report_template = old_report_template
|
||||
return res
|
||||
Reference in New Issue
Block a user