diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py index 33361e81d46..ad9d64baf53 100644 --- a/erpnext/setup/doctype/company/company.py +++ b/erpnext/setup/doctype/company/company.py @@ -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")