From a9db04a719d3d896b87f243642f602b1e57d32fc Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 22 Feb 2022 11:22:17 +0000 Subject: [PATCH] [FIX] base: make _prepare_html a api.model It is used in account.tour.upload.bill without a record Part-of: odoo/odoo#85110 --- odoo/addons/base/models/ir_actions_report.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/odoo/addons/base/models/ir_actions_report.py b/odoo/addons/base/models/ir_actions_report.py index 817aed48c19..bd2d0c9abfe 100644 --- a/odoo/addons/base/models/ir_actions_report.py +++ b/odoo/addons/base/models/ir_actions_report.py @@ -345,7 +345,7 @@ class IrActionsReport(models.Model): return command_args - def _prepare_html(self, html): + def _prepare_html(self, html, report_model=False): '''Divide and recreate the header/footer html by merging all found in html. The bodies are extracted and added to a list. Then, extract the specific_paperformat_args. The idea is to put all headers/footers together. Then, we will use a javascript trick @@ -400,7 +400,7 @@ class IrActionsReport(models.Model): 'base_url': base_url }, raise_if_not_found=False) bodies.append(body) - if node.get('data-oe-model') == self.model: + if node.get('data-oe-model') == report_model: res_ids.append(int(node.get('data-oe-id', 0))) else: res_ids.append(None) @@ -838,7 +838,7 @@ class IrActionsReport(models.Model): html = self_sudo.with_context(context)._render_qweb_html(res_ids, data=data)[0] - bodies, html_ids, header, footer, specific_paperformat_args = self_sudo.with_context(context)._prepare_html(html) + bodies, html_ids, header, footer, specific_paperformat_args = self.with_context(context)._prepare_html(html, report_model=self_sudo.model) if self_sudo.attachment and set(res_ids) != set(html_ids): raise UserError(_("The report's template '%s' is wrong, please contact your administrator. \n\n"