delete communication log for supplier and customer, on trash

This commit is contained in:
Anand Doshi 2012-06-12 14:09:44 +05:30
parent 89e2b3bda4
commit 0146ddcfc6
2 changed files with 12 additions and 0 deletions

View File

@ -158,9 +158,15 @@ class DocType:
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 delete_supplier_communication(self):
webnotes.conn.sql("""\
delete from `tabCommunication`
where supplier = %s and customer is null""", self.doc.name)
def on_trash(self):
self.delete_supplier_address()
self.delete_supplier_contact()
self.delete_supplier_communication()
# on rename
# ---------

View File

@ -235,10 +235,16 @@ class DocType:
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']))
def delete_customer_communication(self):
webnotes.conn.sql("""\
delete from `tabCommunication`
where customer = %s and supplier is null""", self.doc.name)
# ******************************************************* on trash *********************************************************
def on_trash(self):
self.delete_customer_address()
self.delete_customer_contact()
self.delete_customer_communication()
if self.doc.lead_name:
sql("update `tabLead` set status='Interested' where name=%s",self.doc.lead_name)