From 44b469d0c28266d31246353a9fc089d89ab3a639 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Wed, 8 May 2019 19:36:35 +0200 Subject: [PATCH] [IMP] account_tax_balance: Ensure test correctness On certain environments, expense account might not exist, so we create it directly for avoiding problems. --- account_tax_balance/tests/test_account_tax_balance.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/account_tax_balance/tests/test_account_tax_balance.py b/account_tax_balance/tests/test_account_tax_balance.py index 010fcb10..b27ca0a8 100644 --- a/account_tax_balance/tests/test_account_tax_balance.py +++ b/account_tax_balance/tests/test_account_tax_balance.py @@ -46,9 +46,13 @@ class TestAccountTaxBalance(HttpCase): [('user_type_id', '=', self.env.ref( 'account.data_account_type_receivable' ).id)], limit=1).id - invoice_line_account_id = self.env['account.account'].search( - [('user_type_id', '=', self.env.ref( - 'account.data_account_type_expenses').id)], limit=1).id + invoice_line_account_id = self.env['account.account'].create({ + 'user_type_id': self.env.ref( + 'account.data_account_type_expenses' + ).id, + 'code': 'EXPTEST', + 'name': 'Test expense account', + }).id invoice = self.env['account.invoice'].create({ 'partner_id': self.env.ref('base.res_partner_2').id, 'account_id': invoice_account_id,