From 873b7b8a82432c5e7bdfa3ec2873a0b092c42c4d Mon Sep 17 00:00:00 2001 From: "Abdelouahab (abla)" Date: Mon, 11 Apr 2022 13:50:44 +0000 Subject: [PATCH] [FIX] l10n_ch : fix body style in swissqr_report To reproduce ============ - Create a company with a complete Swiss address (street, city, zip and country). - Install the l10n_ch modules and install the Swiss plan comptable in the Settings of the Accounting app. - Go to Accounting > Configuration > Settings > Activate the "QR codes" > Save - Go to Accounting > Configuration > Journals > Choose the journal for the invoices > In "Advanced settings" verify that the communication type is "Based on invoice" and the communication standard is "Switzerland" - Go to Accounting > Configuration > Journals > Select your bank journal(s) > Verify that you have set up your bank account number and the name of the bank - Go to the Contact app > Configuration > Bank Accounts > Choose the one you use for the QR-bills > Edit > In "ISR Client Identification Number" refer a client number and make sure account type is 'IBAN' > Save. - Verify that you have a complete address on the contact form of the customer (street, city, zip and country). - create multiple invoices for this client - try to print QR-bill for these invoices at once -> and assert error is raised Purpose ======= the `assert len(outlines_pages) == len(res_ids)` fails because the generated pdf contains only a single invoice. this issue is caused by the line `` in `swissqr_report.xml`, when `wkhtmltopdf` generates the pdf from html, it doesn't wait for all javascript to finish before rendering the page, which lead to not execute the script `` for some pages then the final pdf is missing some pages. Specification ============= To solve the issue we removed the javascript block `` from the template and move it to python, by setting the body style when generating the html. opw-2772396 closes odoo/odoo#89835 X-original-commit: a669b4c5f78aa18b87f5adcfc5acca3ce0a76040 Signed-off-by: abla001 --- addons/l10n_ch/report/swissqr_report.xml | 10 +++++++--- addons/l10n_ch/static/src/scss/report_swissqr.scss | 2 +- addons/web/views/report_templates.xml | 2 +- odoo/addons/base/models/ir_actions_report.py | 3 ++- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/addons/l10n_ch/report/swissqr_report.xml b/addons/l10n_ch/report/swissqr_report.xml index edcd0d5dea7..ed18b919b5a 100644 --- a/addons/l10n_ch/report/swissqr_report.xml +++ b/addons/l10n_ch/report/swissqr_report.xml @@ -16,9 +16,8 @@ + diff --git a/addons/l10n_ch/static/src/scss/report_swissqr.scss b/addons/l10n_ch/static/src/scss/report_swissqr.scss index 5af11bb9edf..23b89381267 100644 --- a/addons/l10n_ch/static/src/scss/report_swissqr.scss +++ b/addons/l10n_ch/static/src/scss/report_swissqr.scss @@ -10,7 +10,7 @@ $l10n-ch-qr-ratio: 1.25; -body.l10n_ch_qr { +body.l10n_ch_qr, body[data-oe-report="l10n_ch.l10n_ch_qr_report"] { padding: 0; /* Disable custom bakground */ diff --git a/addons/web/views/report_templates.xml b/addons/web/views/report_templates.xml index cd01fed3b8f..695ca362760 100644 --- a/addons/web/views/report_templates.xml +++ b/addons/web/views/report_templates.xml @@ -282,7 +282,7 @@ } - + diff --git a/odoo/addons/base/models/ir_actions_report.py b/odoo/addons/base/models/ir_actions_report.py index 1ebf943b0b4..d3be54967db 100644 --- a/odoo/addons/base/models/ir_actions_report.py +++ b/odoo/addons/base/models/ir_actions_report.py @@ -397,7 +397,8 @@ class IrActionsReport(models.Model): body = IrQweb._render(layout.id, { 'subst': False, 'body': Markup(lxml.html.tostring(node, encoding='unicode')), - 'base_url': base_url + 'base_url': base_url, + 'report_xml_id' : self.xml_id }, raise_if_not_found=False) bodies.append(body) if node.get('data-oe-model') == report_model: