Merge pull request #4814 from rmehta/exclude-bom-from-delete-company

[fix] exclude BOM from delete company records and unset company in others
This commit is contained in:
Anand Doshi 2016-02-16 14:33:21 +05:30
commit d4069fa634

View File

@ -24,9 +24,13 @@ def delete_company_transactions(company_name):
tabDocField where fieldtype='Link' and options='Company'"""): tabDocField where fieldtype='Link' and options='Company'"""):
if doctype not in ("Account", "Cost Center", "Warehouse", "Budget Detail", if doctype not in ("Account", "Cost Center", "Warehouse", "Budget Detail",
"Party Account", "Employee", "Sales Taxes and Charges Template", "Party Account", "Employee", "Sales Taxes and Charges Template",
"Purchase Taxes and Charges Template", "POS Profile"): "Purchase Taxes and Charges Template", "POS Profile", 'BOM'):
delete_for_doctype(doctype, company_name) delete_for_doctype(doctype, company_name)
else:
# un-set company
frappe.db.sql('update `tab{0}` set company="" where company=%s', company_name)
# Clear notification counts # Clear notification counts
clear_notifications() clear_notifications()