From 3a6f4f882af0849678759c02dda37c890fd64e2b Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 12 Sep 2013 19:10:05 +0530 Subject: [PATCH] [fix] [minor] communication related cleanup --- buying/doctype/supplier/supplier.py | 12 ++++-------- hr/doctype/job_applicant/job_applicant.py | 7 +------ install_erpnext.py | 1 + selling/doctype/customer/customer.py | 11 +++-------- selling/doctype/lead/lead.py | 1 - selling/doctype/quotation/quotation.py | 5 ----- utilities/doctype/contact/contact.py | 2 -- 7 files changed, 9 insertions(+), 30 deletions(-) diff --git a/buying/doctype/supplier/supplier.py b/buying/doctype/supplier/supplier.py index 75b2e03762..ccdeae9c65 100644 --- a/buying/doctype/supplier/supplier.py +++ b/buying/doctype/supplier/supplier.py @@ -132,14 +132,10 @@ class DocType(TransactionBase): 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 delete_supplier_communication(self): - webnotes.conn.sql("""\ - delete from `tabCommunication` - where supplier = %s and customer is null""", self.doc.name) - + for contact in webnotes.conn.sql_list("""select name from `tabContact` + where supplier=%s""", self.doc.name): + webnotes.delete_doc("Contact", contact) + def delete_supplier_account(self): """delete supplier's ledger if exist and check balance before deletion""" acc = sql("select name from `tabAccount` where master_type = 'Supplier' \ diff --git a/hr/doctype/job_applicant/job_applicant.py b/hr/doctype/job_applicant/job_applicant.py index 99272303d0..9bf1b967e7 100644 --- a/hr/doctype/job_applicant/job_applicant.py +++ b/hr/doctype/job_applicant/job_applicant.py @@ -21,9 +21,4 @@ class DocType(TransactionBase): else: status = "Open" - webnotes.conn.set(self.doc, 'status', status) - - def on_trash(self): - webnotes.conn.sql("""delete from `tabCommunication` - where job_applicant=%s""", self.doc.name) - \ No newline at end of file + webnotes.conn.set(self.doc, 'status', status) \ No newline at end of file diff --git a/install_erpnext.py b/install_erpnext.py index c57a9e2e7f..70cc2aaa91 100644 --- a/install_erpnext.py +++ b/install_erpnext.py @@ -149,6 +149,7 @@ def install_python_modules(): exec_in_shell("easy_install pip") exec_in_shell("pip install --upgrade pip") + exec_in_shell("pip install --upgrade setuptools") exec_in_shell("pip install --upgrade virtualenv") exec_in_shell("pip install -q %s" % python_modules) diff --git a/selling/doctype/customer/customer.py b/selling/doctype/customer/customer.py index fb3c0062a7..d3a263fbb9 100644 --- a/selling/doctype/customer/customer.py +++ b/selling/doctype/customer/customer.py @@ -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) diff --git a/selling/doctype/lead/lead.py b/selling/doctype/lead/lead.py index 1aff8c865c..da11410f24 100644 --- a/selling/doctype/lead/lead.py +++ b/selling/doctype/lead/lead.py @@ -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) diff --git a/selling/doctype/quotation/quotation.py b/selling/doctype/quotation/quotation.py index 588d8d6e1f..44a67fa45c 100644 --- a/selling/doctype/quotation/quotation.py +++ b/selling/doctype/quotation/quotation.py @@ -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) diff --git a/utilities/doctype/contact/contact.py b/utilities/doctype/contact/contact.py index a116edbdc2..84c8a59de8 100644 --- a/utilities/doctype/contact/contact.py +++ b/utilities/doctype/contact/contact.py @@ -55,7 +55,5 @@ class DocType(TransactionBase): self.doc.is_primary_contact = 1 def on_trash(self): - webnotes.conn.sql("""update tabCommunication set contact='' where contact=%s""", - self.doc.name) webnotes.conn.sql("""update `tabSupport Ticket` set contact='' where contact=%s""", self.doc.name) \ No newline at end of file