From f535de2c28855bb7800c7a47a9236bc63d15e2cb Mon Sep 17 00:00:00 2001 From: Julien Van Roy Date: Fri, 16 Sep 2022 08:23:03 +0000 Subject: [PATCH] [FIX] base: rendering PDF should save ir.attachment Printing an invoice no longer saved the ir.attachment on the move. This is due to the refactor in ffc525419a71aeb05ede6b59dda9e62286a5e66e, since the render methods are now `api.model`, `self.attachment` was always Falsy. To get the attachment name of a report, we need to call `self._get_report(report_ref)`. closes odoo/odoo#100363 Signed-off-by: Laurent Smet --- odoo/addons/base/models/ir_actions_report.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odoo/addons/base/models/ir_actions_report.py b/odoo/addons/base/models/ir_actions_report.py index e805dce13dd..bf9b13e3971 100644 --- a/odoo/addons/base/models/ir_actions_report.py +++ b/odoo/addons/base/models/ir_actions_report.py @@ -799,7 +799,7 @@ class IrActionsReport(models.Model): report_sudo = self._get_report(report_ref) # Generate the ir.attachment if needed. - if self.attachment: + if report_sudo.attachment: attachment_vals_list = [] for res_id, stream_data in collected_streams.items(): # An attachment already exists.