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'