[fix] exclude BOM from delete company records and unset company in others

This commit is contained in:
Rushabh Mehta 2016-02-15 15:17:34 +05:30
parent eab1671214
commit 771568f42a

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()