changeset c226665b242b in modules/account:6.0
details: https://hg.tryton.org/modules/account?cmd=changeset&node=c226665b242b
description:
        Search default chart of account properties only for the company

        issue10924
        review375901002
        (grafted from 54994e1bdde91e324ab05d3b24715510c1549a89)
diffstat:

 account.py            |   2 ++
 tests/test_account.py |  11 +++++++++++
 2 files changed, 13 insertions(+), 0 deletions(-)

diffs (36 lines):

diff -r b49cef68eccf -r c226665b242b account.py
--- a/account.py        Wed Oct 27 17:01:59 2021 +0200
+++ b/account.py        Sun Oct 31 18:46:32 2021 +0100
@@ -2822,9 +2822,11 @@
 
         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 -r b49cef68eccf -r c226665b242b tests/test_account.py
--- a/tests/test_account.py     Wed Oct 27 17:01:59 2021 +0200
+++ b/tests/test_account.py     Sun Oct 31 18:46:32 2021 +0100
@@ -206,6 +206,17 @@
             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'
         pool = Pool()

Reply via email to