From 1be4f8f783cb969866b4817826abb7c90e21ee4d Mon Sep 17 00:00:00 2001 From: Yolann Sabaux Date: Thu, 21 Dec 2023 14:07:07 +0100 Subject: [PATCH] [FIX] l10n_ch: display qr_code once on reprint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Steps to reproduce: - In Settings/technical/actions/reports: find the invoice report - in advanced: activate "Reload from attachment" - create an invoice with a swiss customer - confirm and print - print the invoice again Issue: There are two pages with the same qr-code opw-3626815 closes odoo/odoo#147281 X-original-commit: a6e06531cdd15736b6ed51702e6ba17fb73fe89d Signed-off-by: de Wouters de Bouchout Jean-BenoƮt (jbw) --- addons/l10n_ch/models/ir_actions_report.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/l10n_ch/models/ir_actions_report.py b/addons/l10n_ch/models/ir_actions_report.py index 3d9f35eca3e..b4725a83e2c 100644 --- a/addons/l10n_ch/models/ir_actions_report.py +++ b/addons/l10n_ch/models/ir_actions_report.py @@ -38,6 +38,9 @@ class IrActionsReport(models.Model): # Determine which invoices need a QR. qr_inv_ids = [] for invoice in invoices: + # avoid duplicating existing streams + if report.attachment_use and report.retrieve_attachment(invoice): + continue if invoice.l10n_ch_is_qr_valid: qr_inv_ids.append(invoice.id) # Render the additional reports.