[fix] [patch] fix missing default lead

This commit is contained in:
Anand Doshi 2015-09-24 16:31:36 +05:30
parent d37d4dfdec
commit aea250bc5a

View File

@ -2,6 +2,11 @@ from __future__ import unicode_literals
import frappe
def execute():
# remove missing lead
for customer in frappe.db.sql_list("""select name from `tabCustomer`
where ifnull(lead_name, '')!='' and not exists (select name from `tabLead` where name=`tabCustomer`.lead_name)"""):
frappe.db.set_value("Customer", customer, "lead_name", None)
# remove missing default taxes
for customer in frappe.db.sql_list("""select name from `tabCustomer`
where ifnull(default_taxes_and_charges, '')!='' and not exists (
@ -18,8 +23,3 @@ def execute():
c = frappe.get_doc("Supplier", supplier)
c.default_taxes_and_charges = None
c.save()
# remove missing lead
for customer in frappe.db.sql_list("""select name from `tabCustomer`
where ifnull(lead_name, '')!='' and not exists (select name from `tabLead` where name=`tabCustomer`.lead_name)"""):
frappe.db.set_value("Customer", customer, "lead_name", None)