From d01f0cb46eaeb3e76acb58bf0e253a5d43d16666 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 4 Sep 2013 17:38:29 +0530 Subject: [PATCH] [fix] [communication] on communication send, update status --- hr/doctype/job_applicant/job_applicant.py | 7 ++++++- selling/doctype/lead/lead.py | 7 ++++++- support/doctype/support_ticket/support_ticket.py | 5 ++++- utilities/doctype/contact/contact.py | 7 ++++++- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/hr/doctype/job_applicant/job_applicant.py b/hr/doctype/job_applicant/job_applicant.py index 04b6da9568..1603925bd7 100644 --- a/hr/doctype/job_applicant/job_applicant.py +++ b/hr/doctype/job_applicant/job_applicant.py @@ -15,7 +15,12 @@ class DocType(TransactionBase): return webnotes.conn.get_value('Jobs Email Settings',None,'email_id') def on_communication_sent(self, comm): - webnotes.conn.set(self.doc, 'status', 'Replied') + if webnotes.conn.get_value("Profile", comm.sender, "user_type")=="System User": + status = "Replied" + else: + status = "Open" + + webnotes.conn.set(self.doc, 'status', status) def on_trash(self): webnotes.conn.sql("""delete from `tabCommunication` diff --git a/selling/doctype/lead/lead.py b/selling/doctype/lead/lead.py index 063c5f0d09..d9a631e74b 100644 --- a/selling/doctype/lead/lead.py +++ b/selling/doctype/lead/lead.py @@ -29,7 +29,12 @@ class DocType(SellingController): self.doc.fields["__is_customer"] = customer def on_communication_sent(self, comm): - webnotes.conn.set(self.doc, 'status', 'Replied') + if webnotes.conn.get_value("Profile", comm.sender, "user_type")=="System User": + status = "Replied" + else: + status = "Open" + + webnotes.conn.set(self.doc, 'status', status) def check_status(self): chk = sql("select status from `tabLead` where name=%s", self.doc.name) diff --git a/support/doctype/support_ticket/support_ticket.py b/support/doctype/support_ticket/support_ticket.py index 8e723ee3c1..6958c74586 100644 --- a/support/doctype/support_ticket/support_ticket.py +++ b/support/doctype/support_ticket/support_ticket.py @@ -34,7 +34,10 @@ class DocType(TransactionBase): clear(self.doc.doctype, self.doc.name) def on_communication_sent(self, comm): - self.doc.status = "Waiting for Customer" + if webnotes.conn.get_value("Profile", comm.sender, "user_type")=="System User": + self.doc.status = "Waiting for Customer" + else: + self.doc.status = "Open" self.update_status() self.doc.save() diff --git a/utilities/doctype/contact/contact.py b/utilities/doctype/contact/contact.py index 9997cabea5..78c66aecf7 100644 --- a/utilities/doctype/contact/contact.py +++ b/utilities/doctype/contact/contact.py @@ -13,7 +13,12 @@ class DocType(TransactionBase): self.doclist = doclist def on_communication_sent(self, comm): - webnotes.conn.set(self.doc, 'status', 'Replied') + if webnotes.conn.get_value("Profile", comm.sender, "user_type")=="System User": + status = "Replied" + else: + status = "Open" + + webnotes.conn.set(self.doc, 'status', status) def autoname(self): # concat first and last name