changeset ecc4675f2697 in modules/account_product:6.0
details:
https://hg.tryton.org/modules/account_product?cmd=changeset&node=ecc4675f2697
description:
Search default chart of account properties only for the company
issue10924
review375901002
(grafted from 067a9de7283349947560172a54045d6e47565f38)
diffstat:
account.py | 2 ++
tests/test_account_product.py | 18 ++++++++++++++++++
2 files changed, 20 insertions(+), 0 deletions(-)
diffs (43 lines):
diff -r 59f9ffa6b8c1 -r ecc4675f2697 account.py
--- a/account.py Thu Aug 19 23:23:11 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 59f9ffa6b8c1 -r ecc4675f2697 tests/test_account_product.py
--- a/tests/test_account_product.py Thu Aug 19 23:23:11 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()