Browse Source

[ADD] fix when running tests with accounting

pull/988/head
Holger Brunn 7 years ago
parent
commit
e3feaf1c09
No known key found for this signature in database GPG Key ID: 1C9760FECA3AE18
  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': [
(
4,
{
'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