From 079d99992ba05edc3278046b2598befbb9323050 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Thu, 8 Mar 2018 18:27:03 +0100 Subject: [PATCH] [FIX] account_banking_sepa_direct_debit: * Fix tests due to upstream change Odoo has added a constraint for avoiding a company currency change if there are move lines, making these tests to fail, as the currency is changed to EUR. With this commit, we create a new company with EUR currency for avoiding the problem. This commit also changes account_banking_mandate for not duplicating mandate number, as it was detected during the test creation. Similar to 1f8e345469695d1fb1a2ba2109ddea3adbdf1f78 * Avoid errors in tests when run with other modules * More adaptations to make tests to work properly All these problems comes from using demo data. --- account_banking_mandate/__manifest__.py | 2 +- .../models/account_banking_mandate.py | 4 +++- account_banking_mandate/tests/test_mandate.py | 19 +++++++++---------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/account_banking_mandate/__manifest__.py b/account_banking_mandate/__manifest__.py index 569277f04..7ae0f10ce 100644 --- a/account_banking_mandate/__manifest__.py +++ b/account_banking_mandate/__manifest__.py @@ -7,7 +7,7 @@ { 'name': 'Account Banking Mandate', 'summary': 'Banking mandates', - 'version': '11.0.1.2.0', + 'version': '11.0.1.2.1', 'license': 'AGPL-3', 'author': "Compassion CH, " "Tecnativa, " diff --git a/account_banking_mandate/models/account_banking_mandate.py b/account_banking_mandate/models/account_banking_mandate.py index 65b14a04d..6245567aa 100644 --- a/account_banking_mandate/models/account_banking_mandate.py +++ b/account_banking_mandate/models/account_banking_mandate.py @@ -45,7 +45,9 @@ class AccountBankingMandate(models.Model): default=lambda self: self.env['res.company']._company_default_get( 'account.banking.mandate')) unique_mandate_reference = fields.Char( - string='Unique Mandate Reference', track_visibility='onchange') + string='Unique Mandate Reference', track_visibility='onchange', + copy=False, + ) signature_date = fields.Date(string='Date of Signature of the Mandate', track_visibility='onchange') scan = fields.Binary(string='Scan of the Mandate') diff --git a/account_banking_mandate/tests/test_mandate.py b/account_banking_mandate/tests/test_mandate.py index b113ba7e5..74d0b6dae 100644 --- a/account_banking_mandate/tests/test_mandate.py +++ b/account_banking_mandate/tests/test_mandate.py @@ -19,7 +19,6 @@ class TestMandate(TransactionCase): self.assertEqual(mandate.state, 'draft') mandate.validate() self.assertEqual(mandate.state, 'valid') - self.assertEqual(bank_account.partner_id.mandate_count, 1) mandate.cancel() self.assertEqual(mandate.state, 'cancel') mandate.back2draft() @@ -105,10 +104,10 @@ class TestMandate(TransactionCase): 'signature_date': '2015-01-01', 'company_id': self.company.id, }) - bank_account_2 = self.env.ref( - 'account_payment_mode.res_partner_2_iban') - bank_account_2.company_id = self.company_2 - + bank_account_2 = self.env['res.partner.bank'].create({ + 'acc_number': '1234', + 'company_id': self.company_2.id, + }) with self.assertRaises(ValidationError): mandate.partner_bank_id = bank_account_2 @@ -117,12 +116,12 @@ class TestMandate(TransactionCase): 'signature_date': '2015-01-01', 'company_id': self.company.id, }) - bank_account_2 = self.env.ref( - 'account_payment_mode.res_partner_2_iban') - bank_account_2.company_id = self.company_2 - + bank_account = self.env['res.partner.bank'].create({ + 'acc_number': '1234', + 'company_id': self.company_2.id, + }) with self.assertRaises(ValidationError): - bank_account_2.mandate_ids += mandate + bank_account.mandate_ids += mandate def setUp(self): res = super(TestMandate, self).setUp()