Skip to content

Commit

Permalink
[FIX] account_qr_code_emv: Improve Fallback error
Browse files Browse the repository at this point in the history
At the moment, if EMV QR is selected on the invoice where the country does not support EMV QR an error is raised.

However, this error is also raised if EMV QR is selected but the bank account is not set. The following error is raise
`No EMV QR Code is available for the country of the account False.`
This commit adds a check to ensure the bank account is set and raise a better error message.

Task# 3868467

closes #162552

X-original-commit: e6ca281
Signed-off-by: Nicolas Viseur (vin) <vin@odoo.com>
  • Loading branch information
mhch-odoo committed Apr 19, 2024
1 parent 54e02f6 commit 60cf27a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions addons/account_qr_code_emv/i18n/account_qr_code_emv.pot
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ msgstr ""
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: account_qr_code_emv
#. odoo-python
#: code:addons/account_qr_code_emv/models/res_bank.py:0
#, python-format
msgid "A bank account is required for EMV QR Code generation."
msgstr ""

#. module: account_qr_code_emv
#: model:ir.model,name:account_qr_code_emv.model_res_partner_bank
msgid "Bank Accounts"
Expand Down
2 changes: 2 additions & 0 deletions addons/account_qr_code_emv/models/res_bank.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ def _get_available_qr_methods(self):
def _get_error_messages_for_qr(self, qr_method, debtor_partner, currency):
""" Return an error for emv_qr if the account's country does no match any methods found in inheriting modules."""
if qr_method == 'emv_qr':
if not self:
return _("A bank account is required for EMV QR Code generation.")
return _("No EMV QR Code is available for the country of the account %(account_number)s.", account_number=self.acc_number)

return super()._get_error_messages_for_qr(qr_method, debtor_partner, currency)

0 comments on commit 60cf27a

Please sign in to comment.