From 1bc147484308c4a6312c5a97b8befdf515e79675 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 31 Oct 2021 18:46:32 +0100 Subject: [PATCH] Search default chart of account properties only for the company issue10924 review375901002 (grafted from 54994e1bdde91e324ab05d3b24715510c1549a89) --HG-- branch : 6.0 --- account.py | 2 ++ tests/test_account.py | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/account.py b/account.py index dafada36cc..df20a03561 100644 --- a/account.py +++ b/account.py @@ -2822,9 +2822,11 @@ class CreateChart(Wizard): receivable_accounts = Account.search([ ('type.receivable', '=', True), + ('company', '=', self.account.company.id), ], limit=2) payable_accounts = Account.search([ ('type.payable', '=', True), + ('company', '=', self.account.company.id), ], limit=2) if len(receivable_accounts) == 1: diff --git a/tests/test_account.py b/tests/test_account.py index e99a2cb5f7..65d1594bc9 100644 --- a/tests/test_account.py +++ b/tests/test_account.py @@ -205,6 +205,17 @@ class AccountTestCase( update_chart.start.account = root update_chart.transition_update() + @with_transaction() + def test_account_chart_many_companies(self): + "Test creation of chart of accounts for many companies" + company1 = create_company() + with set_company(company1): + create_chart(company1, tax=True) + + company2 = create_company() + with set_company(company2): + create_chart(company2, tax=True) + @with_transaction() def test_fiscalyear(self): 'Test fiscalyear'