[patch] merge duplicate leads based on email id
This commit is contained in:
parent
9f9877a447
commit
38bef0e4c9
13
patches/july_2013/p04_merge_duplicate_leads.py
Normal file
13
patches/july_2013/p04_merge_duplicate_leads.py
Normal 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)
|
@ -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"
|
||||||
]
|
]
|
Loading…
x
Reference in New Issue
Block a user