From a2d8585b072f5d3fb458948a723ce2d6ce71d822 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 20 May 2015 14:32:39 +0530 Subject: [PATCH] party model patch fix --- erpnext/patches/v4_2/party_model.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/erpnext/patches/v4_2/party_model.py b/erpnext/patches/v4_2/party_model.py index ad5610938e..27df2be7ff 100644 --- a/erpnext/patches/v4_2/party_model.py +++ b/erpnext/patches/v4_2/party_model.py @@ -96,15 +96,16 @@ def set_party_in_jv_and_gl_entry(receivable_payable_accounts): frappe.db.commit() def delete_individual_party_account(): - frappe.db.sql("""delete from `tabAccount` acc - where ifnull(acc.master_type, '') in ('Customer', 'Supplier') - and ifnull(acc.master_name, '') != '' - and not exists(select gle.name from `tabGL Entry` gle where gle.account = acc.name)""") + frappe.db.sql("""delete from `tabAccount` + where ifnull(master_type, '') in ('Customer', 'Supplier') + and ifnull(master_name, '') != '' + and not exists(select gle.name from `tabGL Entry` gle + where gle.account = tabAccount.name);""") - accounts_not_deleted = frappe.db.sql_list("""select name from `tabAccount` acc - where ifnull(acc.master_type, '') in ('Customer', 'Supplier') - and ifnull(acc.master_name, '') != '' - and exists(select gle.name from `tabGL Entry` gle where gle.account = acc.name)""") + accounts_not_deleted = frappe.db.sql_list("""select tabAccount.name from `tabAccount` + where ifnull(master_type, '') in ('Customer', 'Supplier') + and ifnull(master_name, '') != '' + and exists(select gle.name from `tabGL Entry` gle where gle.account = tabAccount.name)""") if accounts_not_deleted: print "Accounts not deleted: " + "\n".join(accounts_not_deleted)