diff --git a/addons/l10n_ch/models/ir_actions_report.py b/addons/l10n_ch/models/ir_actions_report.py index e550fe7adee..fa99cfe483c 100644 --- a/addons/l10n_ch/models/ir_actions_report.py +++ b/addons/l10n_ch/models/ir_actions_report.py @@ -38,8 +38,6 @@ class IrActionsReport(models.Model): # Determine which invoices need a QR. qr_inv_ids = [] for invoice in invoices: - if invoice.company_id.country_code != 'CH': - continue if invoice.l10n_ch_is_qr_valid: qr_inv_ids.append(invoice.id) # Render the additional reports. diff --git a/addons/l10n_ch/models/res_bank.py b/addons/l10n_ch/models/res_bank.py index 081996d8f5a..1b4f0c6fdf5 100644 --- a/addons/l10n_ch/models/res_bank.py +++ b/addons/l10n_ch/models/res_bank.py @@ -201,8 +201,6 @@ class ResPartnerBank(models.Model): error_messages = [_("The Swiss QR code could not be generated for the following reason(s):")] if self.acc_type != 'iban': error_messages.append(_("The account type isn't QR-IBAN or IBAN.")) - if self.partner_id.country_id.code != 'CH': - error_messages.append(_("Your company isn't located in Switzerland.")) if not debtor_partner or debtor_partner.country_id.code not in ('CH', 'LI'): error_messages.append(_("The debtor partner's address isn't located in Switzerland.")) if currency.id not in (self.env.ref('base.EUR').id, self.env.ref('base.CHF').id): diff --git a/addons/l10n_ch/tests/test_ch_qr_code.py b/addons/l10n_ch/tests/test_ch_qr_code.py index 08b5aa1e16b..c94738f0cb0 100644 --- a/addons/l10n_ch/tests/test_ch_qr_code.py +++ b/addons/l10n_ch/tests/test_ch_qr_code.py @@ -80,6 +80,10 @@ class TestSwissQRCode(AccountTestInvoicingCommon): # Assigning a QR reference should fix it self.ch_qr_invoice.payment_reference = '210000000003139471430009017' + # even if the invoice is not issued from Switzerland we want to generate the code + self.ch_qr_invoice.company_id.partner_id.country_id = self.env.ref('base.fr') + self.ch_qr_invoice._generate_qr_code() + def test_ch_qr_code_detection(self): """ Checks Swiss QR-code auto-detection when no specific QR-method is given to the invoice.