diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 20c56f258e0..a58640c52e8 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -3739,7 +3739,7 @@ class AccountMove(models.Model): line[2]['credit'] = currency_id and formatLang(self.env, line[2]['credit'], currency_obj=currency_id) or line[2]['debit'] return preview_vals - def _generate_qr_code(self): + def _generate_qr_code(self, silent_errors=False): """ Generates and returns a QR-code generation URL for this invoice, raising an error message if something is misconfigured. @@ -3770,7 +3770,7 @@ class AccountMove(models.Model): return None unstruct_ref = self.ref if self.ref else self.name - rslt = self.partner_bank_id.build_qr_code_base64(self.amount_residual, unstruct_ref, self.payment_reference, self.currency_id, self.partner_id, qr_code_method, silent_errors=False) + rslt = self.partner_bank_id.build_qr_code_base64(self.amount_residual, unstruct_ref, self.payment_reference, self.currency_id, self.partner_id, qr_code_method, silent_errors=silent_errors) # We only set qr_code_method after generating the url; otherwise, it # could be set even in case of a failure in the QR code generation diff --git a/addons/account/report/account_invoice_report.py b/addons/account/report/account_invoice_report.py index 06b4565dac0..7beb151aa31 100644 --- a/addons/account/report/account_invoice_report.py +++ b/addons/account/report/account_invoice_report.py @@ -145,7 +145,7 @@ class ReportInvoiceWithoutPayment(models.AbstractModel): qr_code_urls = {} for invoice in docs: if invoice.display_qr_code: - new_code_url = invoice._generate_qr_code() + new_code_url = invoice._generate_qr_code(silent_errors=data['report_type'] == 'html') if new_code_url: qr_code_urls[invoice.id] = new_code_url diff --git a/addons/account/views/report_invoice.xml b/addons/account/views/report_invoice.xml index 36354160da8..586b3f20229 100644 --- a/addons/account/views/report_invoice.xml +++ b/addons/account/views/report_invoice.xml @@ -248,7 +248,7 @@ Incoterm: -
Scan me with your banking app.
diff --git a/addons/l10n_in_upi/models/account_invoice.py b/addons/l10n_in_upi/models/account_invoice.py
index d0c4411efd3..a0459530103 100644
--- a/addons/l10n_in_upi/models/account_invoice.py
+++ b/addons/l10n_in_upi/models/account_invoice.py
@@ -9,7 +9,7 @@ from odoo.tools.image import image_data_uri
class AccountMove(models.Model):
_inherit = "account.move"
- def _generate_qr_code(self):
+ def _generate_qr_code(self, silent_errors=False):
self.ensure_one()
if self.company_id.country_code == 'IN':
payment_url = 'upi://pay?pa=%s&pn=%s&am=%s&tr=%s&tn=%s' % (
@@ -20,4 +20,4 @@ class AccountMove(models.Model):
("Payment for %s" % self.name))
barcode = self.env['ir.actions.report'].barcode(barcode_type="QR", value=payment_url, width=120, height=120)
return image_data_uri(base64.b64encode(barcode))
- return super()._generate_qr_code()
+ return super()._generate_qr_code(silent_errors)