[minor] update lead status as Opportunity Made when opportunity submitted

This commit is contained in:
Nabin Hait 2013-09-26 16:59:32 +05:30
parent ca77574a66
commit a1f7f2abfd
2 changed files with 13 additions and 5 deletions

View File

@ -2,7 +2,7 @@
{ {
"creation": "2013-04-10 11:45:37", "creation": "2013-04-10 11:45:37",
"docstatus": 0, "docstatus": 0,
"modified": "2013-09-19 10:38:58", "modified": "2013-09-26 16:30:36",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -111,7 +111,7 @@
"no_copy": 1, "no_copy": 1,
"oldfieldname": "status", "oldfieldname": "status",
"oldfieldtype": "Select", "oldfieldtype": "Select",
"options": "\nOpen\nReplied\nAttempted to Contact\nContact in Future\nContacted\nInterested\nNot interested\nLead Lost\nConverted\nPassive", "options": "\nOpen\nReplied\nAttempted to Contact\nContact in Future\nContacted\nOpportunity Made\nInterested\nNot interested\nLead Lost\nConverted\nPassive",
"reqd": 1, "reqd": 1,
"search_index": 1 "search_index": 1
}, },

View File

@ -128,12 +128,12 @@ class DocType(TransactionBase):
from accounts.utils import validate_fiscal_year from accounts.utils import validate_fiscal_year
validate_fiscal_year(self.doc.transaction_date, self.doc.fiscal_year, "Opportunity Date") validate_fiscal_year(self.doc.transaction_date, self.doc.fiscal_year, "Opportunity Date")
self.doc.status = "Draft"
if not self.doc.status:
self.doc.status = "Draft"
def on_submit(self): def on_submit(self):
webnotes.conn.set(self.doc, 'status', 'Submitted') webnotes.conn.set(self.doc, 'status', 'Submitted')
if self.doc.lead and webnotes.conn.get_value("Lead", self.doc.lead, "status")!="Converted":
webnotes.conn.set_value("Lead", self.doc.lead, "status", "Opportunity Made")
def on_cancel(self): def on_cancel(self):
chk = sql("select t1.name from `tabQuotation` t1, `tabQuotation Item` t2 where t2.parent = t1.name and t1.docstatus=1 and (t1.status!='Order Lost' and t1.status!='Cancelled') and t2.prevdoc_docname = %s",self.doc.name) chk = sql("select t1.name from `tabQuotation` t1, `tabQuotation Item` t2 where t2.parent = t1.name and t1.docstatus=1 and (t1.status!='Order Lost' and t1.status!='Cancelled') and t2.prevdoc_docname = %s",self.doc.name)
@ -142,6 +142,14 @@ class DocType(TransactionBase):
raise Exception raise Exception
else: else:
webnotes.conn.set(self.doc, 'status', 'Cancelled') webnotes.conn.set(self.doc, 'status', 'Cancelled')
if self.doc.lead and webnotes.conn.get_value("Lead", self.doc.lead,
"status")!="Converted":
if webnotes.conn.get_value("Communication", {"parent": self.doc.lead}):
status = "Contacted"
else:
status = "Open"
webnotes.conn.set_value("Lead", self.doc.lead, "status", status)
def declare_enquiry_lost(self,arg): def declare_enquiry_lost(self,arg):
chk = sql("select t1.name from `tabQuotation` t1, `tabQuotation Item` t2 where t2.parent = t1.name and t1.docstatus=1 and (t1.status!='Order Lost' and t1.status!='Cancelled') and t2.prevdoc_docname = %s",self.doc.name) chk = sql("select t1.name from `tabQuotation` t1, `tabQuotation Item` t2 where t2.parent = t1.name and t1.docstatus=1 and (t1.status!='Order Lost' and t1.status!='Cancelled') and t2.prevdoc_docname = %s",self.doc.name)