Browse Source

[ADD] fix when running tests with accounting

10.0
Holger Brunn 7 years ago
committed by OCA-git-bot
parent
commit
36435ddc7d
  1. 21
      base_import_odoo/tests/test_base_import_odoo.py

21
base_import_odoo/tests/test_base_import_odoo.py

@ -7,6 +7,27 @@ from ..models.import_odoo_database import ImportContext, field_context
class TestBaseImportOdoo(TransactionCase): class TestBaseImportOdoo(TransactionCase):
def setUp(self):
super(TestBaseImportOdoo, self).setUp()
# if our tests run with an accounting scheme, it will fail on accounts
# to fix this, if the account model exists, we create mappings for it
if 'account.account' in self.env.registry:
self.env.ref('base_import_odoo.demodb').write({
'import_field_mappings': [
(
0, False,
{
'mapping_type': 'fixed',
'model_id':
self.env.ref('account.model_account_account').id,
'local_id': account.id,
'remote_id': account.id,
},
)
for account in self.env['account.account'].search([])
],
})
@at_install(False) @at_install(False)
@post_install(True) @post_install(True)
@patch( @patch(

Loading…
Cancel
Save