diff --git a/addons/l10n_ch/models/ir_actions_report.py b/addons/l10n_ch/models/ir_actions_report.py index fa99cfe483c..3d9f35eca3e 100644 --- a/addons/l10n_ch/models/ir_actions_report.py +++ b/addons/l10n_ch/models/ir_actions_report.py @@ -43,9 +43,43 @@ class IrActionsReport(models.Model): # Render the additional reports. streams_to_append = {} if qr_inv_ids: - qr_res = self._render_qweb_pdf_prepare_streams('l10n_ch.l10n_ch_qr_report', data, res_ids=qr_inv_ids) - for invoice_id, stream in qr_res.items(): - streams_to_append[invoice_id] = stream + qr_res = self._render_qweb_pdf_prepare_streams( + 'l10n_ch.l10n_ch_qr_report', + { + **data, + 'skip_headers': False, + }, + res_ids=qr_inv_ids, + ) + header = self.env.ref('l10n_ch.l10n_ch_qr_header', raise_if_not_found=False) + if header: + # Make a separated rendering to get the a page containing the company header. Then, merge the qr bill with it. + + header_res = self._render_qweb_pdf_prepare_streams( + 'l10n_ch.l10n_ch_qr_header', + { + **data, + 'skip_headers': True, + }, + res_ids=qr_inv_ids, + ) + + for invoice_id, stream in qr_res.items(): + qr_pdf = OdooPdfFileReader(stream['stream'], strict=False) + header_pdf = OdooPdfFileReader(header_res[invoice_id]['stream'], strict=False) + + page = header_pdf.getPage(0) + page.mergePage(qr_pdf.getPage(0)) + + output_pdf = OdooPdfFileWriter() + output_pdf.addPage(page) + new_pdf_stream = io.BytesIO() + output_pdf.write(new_pdf_stream) + streams_to_append[invoice_id] = {'stream': new_pdf_stream} + else: + for invoice_id, stream in qr_res.items(): + streams_to_append[invoice_id] = stream + # Add to results for invoice_id, additional_stream in streams_to_append.items(): invoice_stream = res[invoice_id]['stream'] diff --git a/addons/l10n_ch/report/swissqr_report.xml b/addons/l10n_ch/report/swissqr_report.xml index ff51c6832c2..d378d7a9d81 100644 --- a/addons/l10n_ch/report/swissqr_report.xml +++ b/addons/l10n_ch/report/swissqr_report.xml @@ -24,22 +24,30 @@ - - - - - - padding-top:6.2mm; padding-left:8.2mm; padding-right:8.2mm; + + QR-bill Header + account.move + qweb-pdf + l10n_ch.qr_report_header + l10n_ch.qr_report_header + + + + + + + + + + + + + - - - QR-bill for invoice - - @@ -61,9 +69,7 @@ - - - + @@ -94,9 +100,7 @@ - - - + @@ -177,9 +181,7 @@ - - - + @@ -221,19 +223,15 @@ - - - + - - - + @@ -244,6 +242,17 @@ + + + + + + + + + + + report_xml_id diff --git a/addons/l10n_ch/static/src/scss/report_swissqr.scss b/addons/l10n_ch/static/src/scss/report_swissqr.scss index bb74bcd1693..fa9f07c3502 100644 --- a/addons/l10n_ch/static/src/scss/report_swissqr.scss +++ b/addons/l10n_ch/static/src/scss/report_swissqr.scss @@ -19,7 +19,7 @@ body.l10n_ch_qr{ /* Disable custom bakground */ .o_report_layout_striped { - background: none; + background-color: white; min-height: 0; } } @@ -53,7 +53,7 @@ body.l10n_ch_qr{ } /* New QR Bill code */ - background-color: white; + background-color: white !important; /* Disable custom font-family */ .o_company_2_layout { @@ -77,6 +77,7 @@ body.l10n_ch_qr{ } .swissqr_receipt { + background-color: white !important; position: absolute; left: 0mm; top: 192mm * $l10n-ch-qr-ratio; @@ -121,6 +122,7 @@ body.l10n_ch_qr{ } .swissqr_body { + background-color: white !important; position: absolute; top: 192mm * $l10n-ch-qr-ratio; left: 62mm * $l10n-ch-qr-ratio; diff --git a/addons/l10n_din5008/report/din5008_report.xml b/addons/l10n_din5008/report/din5008_report.xml index b2024a9f71d..932da75bdb1 100644 --- a/addons/l10n_din5008/report/din5008_report.xml +++ b/addons/l10n_din5008/report/din5008_report.xml @@ -91,16 +91,18 @@ - - - - - - - - - - + + + + + + + + + + + +