fix: set chart of accounts based on parent company on server side

This commit is contained in:
Zlash65 2019-02-13 16:31:37 +05:30 committed by Rohit Waghchaure
parent d787ef8b8e
commit 73acb8c837

View File

@ -39,6 +39,7 @@ class Company(NestedSet):
self.validate_coa_input()
self.validate_perpetual_inventory()
self.check_country_change()
self.set_chart_of_accounts()
def validate_abbr(self):
if not self.abbr:
@ -174,6 +175,12 @@ class Company(NestedSet):
self.country != frappe.get_cached_value('Company', self.name, 'country'):
frappe.flags.country_change = True
def set_chart_of_accounts(self):
''' If parent company is set, chart of accounts will be based on that company '''
if self.parent_company:
self.create_chart_of_accounts_based_on = "Existing Company"
self.existing_company = self.parent_company
def set_default_accounts(self):
self._set_default_account("default_cash_account", "Cash")
self._set_default_account("default_bank_account", "Bank")