Skip to content

Commit

Permalink
[FIX] fix sale_order_ubl after reporting engine improvement #919275ed…
Browse files Browse the repository at this point in the history
…ef5f5e206954cc6159217dc4e4cdfd67
  • Loading branch information
cvinh authored and Alexis de Lattre committed Apr 29, 2020
1 parent 735e8b8 commit 40c5eaa
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions sale_order_ubl/models/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 40c5eaa

Please sign in to comment.