[Minor] Create default department on country setup (#15206)

* make default department when creating new company

* remove departments and tds entry for the company
This commit is contained in:
Zarrar 2018-08-24 11:26:51 +05:30 committed by Nabin Hait
parent 8fe8d1758a
commit 2b2712bb9e

View File

@ -95,6 +95,10 @@ class Company(NestedSet):
if frappe.flags.country_change: if frappe.flags.country_change:
install_country_fixtures(self.name) install_country_fixtures(self.name)
if not frappe.db.get_value("Department", {"company": self.name}):
from erpnext.setup.setup_wizard.operations.install_fixtures import install_post_company_fixtures
install_post_company_fixtures(self.name)
if not frappe.db.get_value("Cost Center", {"is_group": 0, "company": self.name}): if not frappe.db.get_value("Cost Center", {"is_group": 0, "company": self.name}):
self.create_default_cost_center() self.create_default_cost_center()
@ -329,6 +333,8 @@ class Company(NestedSet):
% (dt, ', '.join(['%s']*len(boms))), tuple(boms)) % (dt, ', '.join(['%s']*len(boms))), tuple(boms))
frappe.db.sql("delete from tabEmployee where company=%s", self.name) frappe.db.sql("delete from tabEmployee where company=%s", self.name)
frappe.db.sql("delete from tabDepartment where company=%s", self.name)
frappe.db.sql("delete from `tabTax Withholding Account` where company=%s", self.name)
@frappe.whitelist() @frappe.whitelist()
def enqueue_replace_abbr(company, old, new): def enqueue_replace_abbr(company, old, new):