From 8ed2f874804ebe803b416f2bfdefa8f929a9b033 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 25 May 2016 20:06:24 +0530 Subject: [PATCH] Update company.py --- erpnext/setup/doctype/company/company.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py index ebb7805aa5..faca7a2619 100644 --- a/erpnext/setup/doctype/company/company.py +++ b/erpnext/setup/doctype/company/company.py @@ -194,8 +194,9 @@ class Company(Document): rec = frappe.db.sql("SELECT name from `tabGL Entry` where company = %s", self.name) if not rec: - frappe.db.sql("""delete from `tabBudget Account` b - where exists(select name from tabBudget where name=b.parent and company = %s)""", self.name) + frappe.db.sql("""delete from `tabBudget Account` + where exists(select name from tabBudget + where name=`tabBudget Account`.parent and company = %s)""", self.name) for doctype in ["Account", "Cost Center", "Budget", "Party Account"]: frappe.db.sql("delete from `tab{0}` where company = %s".format(doctype), self.name)