From aed09fc6304fbd498efd4c3210d9506f07d64952 Mon Sep 17 00:00:00 2001 From: Sergi Almacellas Abellana Date: Fri, 28 May 2021 09:03:50 +0200 Subject: [PATCH] Add tests for analytic line state with several companies --- tests/test_analytic_account.py | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/tests/test_analytic_account.py b/tests/test_analytic_account.py index 2a2ffcdd76..18c12b93d2 100644 --- a/tests/test_analytic_account.py +++ b/tests/test_analytic_account.py @@ -136,9 +136,7 @@ class AnalyticAccountTestCase(CompanyTestMixin, ModuleTestCase): (Decimal(30), Decimal(100))) self.assertEqual(analytic_account.balance, Decimal(70)) - @with_transaction() - def test_move_line_state(self): - "Test move line state" + def _test_analytic_line_state(self): pool = Pool() Party = pool.get('party.party') AnalyticAccount = pool.get('analytic_account.account') @@ -213,6 +211,31 @@ class AnalyticAccountTestCase(CompanyTestMixin, ModuleTestCase): self.assertEqual(expense_line.analytic_state, 'valid') + @with_transaction() + def test_move_line_state(self): + "Test move line state" + self._test_analytic_line_state() + + @with_transaction() + def test_move_line_state_roots_several_companies(self): + "Test move line state with roots from several companies" + pool = Pool() + Account = pool.get('analytic_account.account') + + extra_company = create_company() + with set_company(extra_company): + root, = Account.create([{ + 'type': 'root', + 'name': 'Root', + }]) + analytic_account, = Account.create([{ + 'type': 'normal', + 'name': 'Analytic Account', + 'parent': root.id, + 'root': root.id, + }]) + self._test_analytic_line_state() + @with_transaction() def test_account_distribute(self): "Test account distribute"