summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--addons/l10n_ch/models/account_invoice.py2
-rw-r--r--addons/l10n_ch/tests/test_l10n_ch_isr.py22
2 files changed, 11 insertions, 13 deletions
diff --git a/addons/l10n_ch/models/account_invoice.py b/addons/l10n_ch/models/account_invoice.py
index b0ff383c01a..5799f41384f 100644
--- a/addons/l10n_ch/models/account_invoice.py
+++ b/addons/l10n_ch/models/account_invoice.py
@@ -142,7 +142,6 @@ class AccountMove(models.Model):
@api.depends(
'move_type', 'name', 'currency_id.name',
- 'partner_bank_id.l10n_ch_postal',
'partner_bank_id.l10n_ch_isr_subscription_eur',
'partner_bank_id.l10n_ch_isr_subscription_chf')
def _compute_l10n_ch_isr_valid(self):
@@ -151,7 +150,6 @@ class AccountMove(models.Model):
record.l10n_ch_isr_valid = record.move_type == 'out_invoice' and\
record.name and \
record.l10n_ch_isr_subscription and \
- record.partner_bank_id.l10n_ch_postal and \
record.l10n_ch_currency_name in ['EUR', 'CHF']
def split_total_amount(self):
diff --git a/addons/l10n_ch/tests/test_l10n_ch_isr.py b/addons/l10n_ch/tests/test_l10n_ch_isr.py
index 1316613313e..541a2d7e0e5 100644
--- a/addons/l10n_ch/tests/test_l10n_ch_isr.py
+++ b/addons/l10n_ch/tests/test_l10n_ch_isr.py
@@ -34,6 +34,15 @@ class ISRTest(AccountTestCommon):
""" Generates a test res.partner.bank. """
return self.env['res.partner.bank'].create({
'acc_number': number,
+ 'partner_id': self.env.ref("base.res_partner_2").id,
+ })
+
+ def create_isr_issuer_account(self, number):
+ """ Generates a test res.partner.bank on company """
+ return self.env['res.partner.bank'].create({
+ 'acc_number': "ISR {} number",
+ 'partner_id': self.env.user.company_id.partner_id.id,
+ 'l10n_ch_isr_subscription_chf': number,
})
def print_isr(self, invoice):
@@ -79,18 +88,9 @@ class ISRTest(AccountTestCommon):
invoice_1 = self.create_invoice('base.CHF')
self.isr_not_generated(invoice_1)
- #Now we add an account for payment to our invoice, but still cannot generate the ISR
- test_account = self.create_account('250097798')
+ #Now we add an account for payment to our invoice, the ISR can be generated
+ test_account = self.create_isr_issuer_account('01-39139-1')
invoice_1.partner_bank_id = test_account
- self.isr_not_generated(invoice_1)
-
- #Finally, we add bank coordinates to our account. The ISR should now be available to generate
- test_bank = self.env['res.bank'].create({
- 'name':'Money Drop',
- 'l10n_ch_postal_chf':'010391391'
- })
-
- test_account.bank_id = test_bank
self.isr_generated(invoice_1)
#Now, let us show that, with the same data, an invoice in euros does not generate any ISR (because the bank does not have any EUR postal reference)