changeset 067a9de72833 in modules/account_product:default
details:
https://hg.tryton.org/modules/account_product?cmd=changeset&node=067a9de72833
description:
Search default chart of account properties only for the company
issue10924
review375901002
diffstat:
account.py | 2 ++
tests/test_account_product.py | 18 ++++++++++++++++++
2 files changed, 20 insertions(+), 0 deletions(-)
diffs (43 lines):
diff -r 278134178a95 -r 067a9de72833 account.py
--- a/account.py Sat Oct 30 11:32:01 2021 +0200
+++ b/account.py Sun Oct 31 18:46:32 2021 +0100
@@ -52,9 +52,11 @@
defaults = super(CreateChart, self).default_properties(fields)
expense_accounts = Account.search([
('type.expense', '=', True),
+ ('company', '=', self.account.company.id),
], limit=2)
revenue_accounts = Account.search([
('type.revenue', '=', True),
+ ('company', '=', self.account.company.id),
], limit=2)
if len(expense_accounts) == 1:
defaults['category_account_expense'] = expense_accounts[0].id
diff -r 278134178a95 -r 067a9de72833 tests/test_account_product.py
--- a/tests/test_account_product.py Sat Oct 30 11:32:01 2021 +0200
+++ b/tests/test_account_product.py Sun Oct 31 18:46:32 2021 +0100
@@ -19,6 +19,24 @@
extras = ['analytic_account']
@with_transaction()
+ def test_account_chart(self):
+ "Test creation of chart of accounts"
+ company = create_company()
+ with set_company(company):
+ create_chart(company, tax=True)
+
+ @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_account_used(self):
'Test account used'
pool = Pool()