Search default chart of account properties only for the company

issue10924
review375901002
This commit is contained in:
Cédric Krier committed 2021-10-31 18:46:32 +01:00
1 parent 2b859629ad
commit a43cdc3cdd
2 files changed
+20

No files matched your search

+2
View File
@@ -52,9 +52,11 @@ class CreateChart(metaclass=PoolMeta):
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
+18
View File
@@ -18,6 +18,24 @@ class AccountProductTestCase(CompanyTestMixin, ModuleTestCase):
module = 'account_product'
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'