mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-18 09:05:00 +00:00
delete communication log for supplier and customer, on trash
This commit is contained in:
@@ -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
|
||||
# ---------
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user