[IMP] account_tax_balance: Ensure test correctness

On certain environments, expense account might not exist, so we create it directly
for avoiding problems.
pull/937/head
Pedro M. Baeza 2019-05-08 19:36:35 +02:00 committed by David Ramia
parent 39672c9c4e
commit 9563457d06
1 changed files with 7 additions and 3 deletions

View File

@ -46,9 +46,13 @@ class TestAccountTaxBalance(HttpCase):
[('user_type_id', '=', self.env.ref( [('user_type_id', '=', self.env.ref(
'account.data_account_type_receivable' 'account.data_account_type_receivable'
).id)], limit=1).id ).id)], limit=1).id
invoice_line_account_id = self.env['account.account'].search( invoice_line_account_id = self.env['account.account'].create({
[('user_type_id', '=', self.env.ref( 'user_type_id': self.env.ref(
'account.data_account_type_expenses').id)], limit=1).id 'account.data_account_type_expenses'
).id,
'code': 'EXPTEST',
'name': 'Test expense account',
}).id
invoice = self.env['account.invoice'].create({ invoice = self.env['account.invoice'].create({
'partner_id': self.env.ref('base.res_partner_2').id, 'partner_id': self.env.ref('base.res_partner_2').id,
'account_id': invoice_account_id, 'account_id': invoice_account_id,