[patch] merge duplicate leads based on email id

This commit is contained in:
Anand Doshi 2013-07-16 12:59:23 +05:30
parent 9f9877a447
commit 38bef0e4c9
2 changed files with 14 additions and 0 deletions

View File

@ -0,0 +1,13 @@
import webnotes
from webnotes.utils import extract_email_id
def execute():
email_lead = {}
for name, email in webnotes.conn.sql("""select name, email_id from `tabLead`
where ifnull(email_id, '')!='' order by creation asc"""):
email = extract_email_id(email)
if email:
if email not in email_lead:
email_lead[email] = name
else:
webnotes.rename("Lead", name, email_lead[email], merge=True)

View File

@ -251,4 +251,5 @@ patch_list = [
"patches.july_2013.p02_copy_shipping_address", "patches.july_2013.p02_copy_shipping_address",
"patches.july_2013.p03_cost_center_company", "patches.july_2013.p03_cost_center_company",
"execute:webnotes.bean('Style Settings').save() #2013-07-16", "execute:webnotes.bean('Style Settings').save() #2013-07-16",
"patches:july_2013.p04_merge_duplicate_leads"
] ]