Browse Source

[RFR] 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.
pull/82/head
Stefan Rijnhart 8 years ago
parent
commit
c614c4f237
  1. 3
      account_bank_statement_import_camt/__openerp__.py
  2. 15
      account_bank_statement_import_camt/demo/demo_data.xml
  3. 15
      account_bank_statement_import_camt/tests/test_import_bank_statement.py

3
account_bank_statement_import_camt/__openerp__.py

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

15
account_bank_statement_import_camt/demo/demo_data.xml

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

15
account_bank_statement_import_camt/tests/test_import_bank_statement.py

@ -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 = {}

Loading…
Cancel
Save