From 771568f42ae847a313b4e2c4f6b9a01a00e89497 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 15 Feb 2016 15:17:34 +0530 Subject: [PATCH] [fix] exclude BOM from delete company records and unset company in others --- .../setup/doctype/company/delete_company_transactions.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/erpnext/setup/doctype/company/delete_company_transactions.py b/erpnext/setup/doctype/company/delete_company_transactions.py index 506ccffbf6..00ac76c619 100644 --- a/erpnext/setup/doctype/company/delete_company_transactions.py +++ b/erpnext/setup/doctype/company/delete_company_transactions.py @@ -24,9 +24,13 @@ def delete_company_transactions(company_name): tabDocField where fieldtype='Link' and options='Company'"""): if doctype not in ("Account", "Cost Center", "Warehouse", "Budget Detail", "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) + else: + # un-set company + frappe.db.sql('update `tab{0}` set company="" where company=%s', company_name) + # Clear notification counts clear_notifications()