From e527ce5346da0d9068fe9f214c2f02b3ec2ed4fc Mon Sep 17 00:00:00 2001 From: lreficent Date: Tue, 20 Dec 2016 15:46:05 +0100 Subject: [PATCH] [FIX] adapts test to v9 --- .../tests/test_account_move_line_stock_move.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/account_move_line_stock_info/tests/test_account_move_line_stock_move.py b/account_move_line_stock_info/tests/test_account_move_line_stock_move.py index 6a10210d8..67244a18c 100644 --- a/account_move_line_stock_info/tests/test_account_move_line_stock_move.py +++ b/account_move_line_stock_info/tests/test_account_move_line_stock_move.py @@ -32,20 +32,20 @@ class TestAccountMoveLineStockInfo(common.TransactionCase): 'account.group_account_manager') # Create account for Goods Received Not Invoiced - acc_type = 'equity' + acc_type = self._create_account_type('equity', 'other') name = 'Goods Received Not Invoiced' code = 'grni' self.account_grni = self._create_account(acc_type, name, code, self.company) # Create account for Cost of Goods Sold - acc_type = 'expense' + acc_type = self._create_account_type('expense', 'other') name = 'Cost of Goods Sold' code = 'cogs' self.account_cogs = self._create_account(acc_type, name, code, self.company) # Create account for Inventory - acc_type = 'asset' + acc_type = self._create_account_type('asset', 'other') name = 'Inventory' code = 'inventory' self.account_inventory = self._create_account(acc_type, name, code, @@ -82,14 +82,20 @@ class TestAccountMoveLineStockInfo(common.TransactionCase): }) return user.id + def _create_account_type(self, name, type): + acc_type = self.acc_type_model.create({ + 'name': name, + 'type': type + }) + return acc_type + def _create_account(self, acc_type, name, code, company): """Create an account.""" - types = self.acc_type_model.search([('code', '=', acc_type)]) account = self.account_model.create({ 'name': name, 'code': code, 'type': 'other', - 'user_type': types and types[0].id, + 'user_type_id': acc_type.id, 'company_id': company.id }) return account