mirror of
https://github.com/bringout/oca-report.git
synced 2026-04-23 08:02:07 +02:00
Initial commit: OCA Report packages (45 packages)
This commit is contained in:
commit
2f4db400df
2543 changed files with 469120 additions and 0 deletions
|
|
@ -0,0 +1 @@
|
|||
from . import mail_compose_message
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
# 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.model
|
||||
def generate_email_for_composer(self, template_id, res_ids, fields):
|
||||
if self.template_id:
|
||||
report_template = self.template_id.report_template
|
||||
active_ids = []
|
||||
if self.env.context.get("active_ids"):
|
||||
active_ids = self.env.context.get("active_ids")
|
||||
elif self.env.context.get("default_res_id"):
|
||||
active_ids = [self.env.context.get("default_res_id")]
|
||||
if (
|
||||
report_template
|
||||
and report_template.action_report_substitution_rule_ids
|
||||
and active_ids
|
||||
):
|
||||
report_template = (
|
||||
self.template_id.report_template.get_substitution_report(active_ids)
|
||||
)
|
||||
return super(
|
||||
MailComposeMessage,
|
||||
self.with_context(default_report_template=report_template),
|
||||
).generate_email_for_composer(template_id, res_ids, fields)
|
||||
return super().generate_email_for_composer(template_id, res_ids, fields)
|
||||
Loading…
Add table
Add a link
Reference in a new issue