From 40c5eaa21d0a1ba1a940dd4a53de825d45cc54b9 Mon Sep 17 00:00:00 2001 From: Cyril VINH-TUNG Date: Fri, 24 Apr 2020 22:17:11 -1000 Subject: [PATCH] [FIX] fix sale_order_ubl after reporting engine improvement #919275edef5f5e206954cc6159217dc4e4cdfd67 --- sale_order_ubl/models/report.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sale_order_ubl/models/report.py b/sale_order_ubl/models/report.py index b622d80666..86448e29d2 100644 --- a/sale_order_ubl/models/report.py +++ b/sale_order_ubl/models/report.py @@ -8,16 +8,17 @@ class IrActionsReport(models.Model): _inherit = "ir.actions.report" @api.multi - def render_qweb_pdf(self, res_ids=None, data=None): + def _post_pdf(self, save_in_attachment, pdf_content=None, res_ids=None): """We go through that method when the PDF is generated for the 1st time and also when it is read from the attachment. This method is specific to QWeb""" - pdf_content = super().render_qweb_pdf(res_ids, data) if ( len(self) == 1 and self.report_name == 'sale.report_saleorder' and + res_ids and len(res_ids) == 1 and not self._context.get('no_embedded_ubl_xml')): order = self.env['sale.order'].browse(res_ids[0]) pdf_content = order.embed_ubl_xml_in_pdf(pdf_content=pdf_content) - return pdf_content + return super()._post_pdf( + save_in_attachment, pdf_content=pdf_content, res_ids=res_ids)