OCA reporting engine fork for dev and update.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
796 B

  1. # Copyright 2019 ACSONE SA/NV
  2. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  3. from odoo import api, models
  4. class MailThread(models.AbstractModel):
  5. _inherit = 'mail.thread'
  6. @api.multi
  7. def message_post_with_template(self, template_id, **kwargs):
  8. template = self.env['mail.template'].browse(template_id)
  9. old_report = False
  10. if template and template.report_template and self.ids:
  11. active_ids = self.ids
  12. old_report = template.report_template
  13. template.report_template = old_report.get_substitution_report(
  14. active_ids
  15. )
  16. res = super().message_post_with_template(template_id, **kwargs)
  17. if old_report:
  18. template.report_template = old_report
  19. return res