Create demo data during the execution of tests This ensures that the demo chart of accounts is already installed when the bank journal account is created for the bank journal that is needed to test the import. Otherwise, the demo chart from l10n_generic_coa will fail to install because there is already a journal account in the system.

This commit is contained in:
Stefan Rijnhart
2016-12-09 17:29:09 +01:00
committed by Maxence Groine
parent 6e143fa4ff
commit 33a11d4a23
3 changed files with 15 additions and 18 deletions

View File

@@ -11,9 +11,6 @@
'depends': [
'account_bank_statement_import',
],
'demo': [
'demo/demo_data.xml',
],
'data': [
'views/account_bank_statement_import.xml',
],

View File

@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="camt_company_bank" model="res.partner.bank">
<field name="acc_number">NL77ABNA0574908765</field>
<field name="partner_id" ref="base.main_partner"></field>
<field name="company_id" ref="base.main_company"></field>
<field name="bank_id" ref="base.res_bank_1"/>
</record>
<record id="camt_bank_journal" model="account.journal">
<field name="name">Bank Journal - (test camt)</field>
<field name="code">TBNKCAMT</field>
<field name="type">bank</field>
<field name="bank_account_id" ref="camt_company_bank" />
</record>
</odoo>

View File

@@ -18,6 +18,21 @@ class TestImport(TransactionCase):
},
]
def setUp(self):
super(TestImport, self).setUp()
bank = self.env['res.partner.bank'].create({
'acc_number': 'NL77ABNA0574908765',
'partner_id': self.env.ref('base.main_partner').id,
'company_id': self.env.ref('base.main_company').id,
'bank_id': self.env.ref('base.res_bank_1').id,
})
self.env['account.journal'].create({
'name': 'Bank Journal - (test camt)',
'code': 'TBNKCAMT',
'type': 'bank',
'bank_account_id': bank.id,
})
def test_statement_import(self):
"""Test correct creation of single statement."""
action = {}