Merge branch 'master' of git@github.com:webnotes/erpnext

This commit is contained in:
nabinhait 2011-06-20 16:36:10 +05:30
commit e82656beef
2 changed files with 22 additions and 1 deletions

View File

@ -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)

View File

@ -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()