[fix] [minor] communication related cleanup

This commit is contained in:
Anand Doshi
2013-09-12 19:10:05 +05:30
parent 24416f92cc
commit 3a6f4f882a
7 changed files with 9 additions and 30 deletions

View File

@@ -126,14 +126,10 @@ class DocType(TransactionBase):
webnotes.conn.sql("""delete from `tabAddress` where name=%s""", 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']))
for contact in webnotes.conn.sql_list("""select name from `tabContact`
where customer=%s""", self.doc.name):
webnotes.delete_doc("Contact", contact)
def delete_customer_communication(self):
webnotes.conn.sql("""\
delete from `tabCommunication`
where customer = %s and supplier is null""", self.doc.name)
def delete_customer_account(self):
"""delete customer's ledger if exist and check balance before deletion"""
acc = sql("select name from `tabAccount` where master_type = 'Customer' \
@@ -145,7 +141,6 @@ class DocType(TransactionBase):
def on_trash(self):
self.delete_customer_address()
self.delete_customer_contact()
self.delete_customer_communication()
self.delete_customer_account()
if self.doc.lead_name:
sql("update `tabLead` set status='Interested' where name=%s",self.doc.lead_name)

View File

@@ -80,7 +80,6 @@ class DocType(SellingController):
return webnotes.conn.get_value('Sales Email Settings',None,'email_id')
def on_trash(self):
webnotes.conn.sql("""update tabCommunication set lead=null where lead=%s""", self.doc.name)
webnotes.conn.sql("""update `tabSupport Ticket` set lead='' where lead=%s""",
self.doc.name)

View File

@@ -204,11 +204,6 @@ class DocType(SellingController):
print_lst.append(lst1)
return print_lst
def update_followup_details(self):
sql("delete from `tabCommunication Log` where parent = '%s'"%self.doc.name)
for d in getlist(self.doclist, 'follow_up'):
d.save()
@webnotes.whitelist()
def make_sales_order(source_name, target_doclist=None):
return _make_sales_order(source_name, target_doclist)