[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.
This commit is contained in:
Pedro M. Baeza
2018-03-08 18:27:03 +01:00
parent 5b7681c211
commit 079d99992b
3 changed files with 13 additions and 12 deletions

View File

@@ -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, "

View File

@@ -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')

View File

@@ -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()