diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index e0cd13f76d8..fb216f05347 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -3768,7 +3768,7 @@ class AccountMove(models.Model): else: # Else we find one that's eligible and assign it to the invoice for candidate_method, _candidate_name in self.env['res.partner.bank'].get_available_qr_methods_in_sequence(): - if self.partner_bank_id._eligible_for_qr_code(candidate_method, self.partner_id, self.currency_id): + if self.partner_bank_id._eligible_for_qr_code(candidate_method, self.partner_id, self.currency_id, raises_error=False): qr_code_method = candidate_method break diff --git a/addons/l10n_ch/__manifest__.py b/addons/l10n_ch/__manifest__.py index 4de7e40085e..ec74bbdb94f 100644 --- a/addons/l10n_ch/__manifest__.py +++ b/addons/l10n_ch/__manifest__.py @@ -49,6 +49,7 @@ Here is how it works: 'report/swissqr_report.xml', 'views/res_bank_view.xml', 'views/account_invoice_view.xml', + 'views/account_invoice.xml', 'views/res_config_settings_views.xml', 'views/setup_wizard_views.xml', 'views/qr_invoice_wizard_view.xml' diff --git a/addons/l10n_ch/models/res_bank.py b/addons/l10n_ch/models/res_bank.py index d24673ff425..a06542d2d81 100644 --- a/addons/l10n_ch/models/res_bank.py +++ b/addons/l10n_ch/models/res_bank.py @@ -347,6 +347,8 @@ class ResPartnerBank(models.Model): # see https://github.com/arthurdejong/python-stdnum/blob/master/stdnum/iso11649.py def _eligible_for_qr_code(self, qr_method, debtor_partner, currency, raises_error=True): + if qr_method == 'sct_qr' and debtor_partner.country_id.code == 'CH' and self.journal_id.country_code == 'CH': + return False if qr_method == 'ch_qr': error_messages = [_("The QR code could not be generated for the following reason(s):")] if self.acc_type != 'iban': diff --git a/addons/l10n_ch/views/account_invoice.xml b/addons/l10n_ch/views/account_invoice.xml new file mode 100644 index 00000000000..9bbd33c772c --- /dev/null +++ b/addons/l10n_ch/views/account_invoice.xml @@ -0,0 +1,8 @@ + + + +