Merge branch 'master' of git@github.com:webnotes/erpnext
This commit is contained in:
commit
e82656beef
@ -214,8 +214,17 @@ class DocType:
|
|||||||
#create address and contact from lead
|
#create address and contact from lead
|
||||||
self.create_lead_address_contact()
|
self.create_lead_address_contact()
|
||||||
|
|
||||||
|
def delete_customer_address(self):
|
||||||
|
for rec in sql("select * from `tabAddress` where customer='%s'" %(self.doc.name), as_dict=1):
|
||||||
|
sql("delete from `tabAddress` where name=%s",(rec['name']))
|
||||||
|
|
||||||
|
def delete_customer_contact(self):
|
||||||
|
for rec in sql("select * from `tabContact` where customer='%s'" %(self.doc.name), as_dict=1):
|
||||||
|
sql("delete from `tabContact` where name=%s",(rec['name']))
|
||||||
|
|
||||||
# ******************************************************* on trash *********************************************************
|
# ******************************************************* on trash *********************************************************
|
||||||
def on_trash(self):
|
def on_trash(self):
|
||||||
|
self.delete_customer_address()
|
||||||
|
self.delete_customer_contact()
|
||||||
if self.doc.lead_name:
|
if self.doc.lead_name:
|
||||||
sql("update `tabLead` set status='Interested' where name=%s",self.doc.lead_name)
|
sql("update `tabLead` set status='Interested' where name=%s",self.doc.lead_name)
|
||||||
|
@ -134,3 +134,15 @@ class DocType:
|
|||||||
return contact_details
|
return contact_details
|
||||||
else:
|
else:
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
def delete_supplier_address(self):
|
||||||
|
for rec in sql("select * from `tabAddress` where supplier='%s'" %(self.doc.name), as_dict=1):
|
||||||
|
sql("delete from `tabAddress` where name=%s",(rec['name']))
|
||||||
|
|
||||||
|
def delete_supplier_contact(self):
|
||||||
|
for rec in sql("select * from `tabContact` where supplier='%s'" %(self.doc.name), as_dict=1):
|
||||||
|
sql("delete from `tabContact` where name=%s",(rec['name']))
|
||||||
|
|
||||||
|
def on_trash(self):
|
||||||
|
self.delete_supplier_address()
|
||||||
|
self.delete_supplier_contact()
|
||||||
|
Loading…
Reference in New Issue
Block a user