From 4e9e96db9e2540012ded5669944290a099bdca3a Mon Sep 17 00:00:00 2001 From: Mylyna Hy Date: Wed, 1 Mar 2023 01:27:29 +0000 Subject: [PATCH] [FIX] res_partner_bank: set error flag for qr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: With Switzerland accounting localization installed, the user is unable to create vendor payments for non-Swiss contacts or contacts with non-IBAN accounts because a qr code will try to generate due to compute_qr_code. Eventually, an error will be thrown since the raises_error param for _eligible_for_qr_code is True by default. When _build_qr_code_vals calls _eligible_for_qr_code, it did not explicitly pass the raises_error arg. Thus, instead of returning None, an error is thrown instead, blocking futher operations. Proposed Solution: Method _build_qr_code_vals should pass raises_error = not silent_error to _eligible_for_qr_code. There is an inverse relation between silent_error and raises_error. By default, silent_error is True so it's safe to assume that raises_error = False because the compute for the qr code on payments should not raise any error. This fix will resolve the issue when computing the qr code for payments while being fluid with other method calls. closes odoo/odoo#114256 X-original-commit: 45d34a8630918abe2f988f7ed0e0df153a3edd51 Signed-off-by: William André (wan) --- addons/account/models/res_partner_bank.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/res_partner_bank.py b/addons/account/models/res_partner_bank.py index 5613c77aacc..09b0683bc7d 100644 --- a/addons/account/models/res_partner_bank.py +++ b/addons/account/models/res_partner_bank.py @@ -55,7 +55,7 @@ class ResPartnerBank(models.Model): available_qr_methods = self.get_available_qr_methods_in_sequence() candidate_methods = qr_method and [(qr_method, dict(available_qr_methods)[qr_method])] or available_qr_methods for candidate_method, candidate_name in candidate_methods: - if self._eligible_for_qr_code(candidate_method, debtor_partner, currency): + if self._eligible_for_qr_code(candidate_method, debtor_partner, currency, not silent_errors): error_message = self._check_for_qr_code_errors(candidate_method, amount, currency, debtor_partner, free_communication, structured_communication) if not error_message: