mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-05 05:09:11 +00:00
Cleanup of lead and opportunity status updating logic
This commit is contained in:
@@ -16,6 +16,7 @@ class Quotation(SellingController):
|
||||
def validate(self):
|
||||
super(Quotation, self).validate()
|
||||
self.set_status()
|
||||
self.update_opportunity()
|
||||
self.validate_order_type()
|
||||
self.validate_uom_is_integer("stock_uom", "qty")
|
||||
self.validate_quotation_to()
|
||||
@@ -35,6 +36,10 @@ class Quotation(SellingController):
|
||||
elif self.lead:
|
||||
self.quotation_to = "Lead"
|
||||
|
||||
def update_lead(self):
|
||||
if self.lead:
|
||||
frappe.get_doc("Lead", self.lead).set_status(update=True)
|
||||
|
||||
def update_opportunity(self):
|
||||
for opportunity in list(set([d.prevdoc_docname for d in self.get("items")])):
|
||||
if opportunity:
|
||||
@@ -45,6 +50,7 @@ class Quotation(SellingController):
|
||||
frappe.db.set(self, 'status', 'Lost')
|
||||
frappe.db.set(self, 'order_lost_reason', arg)
|
||||
self.update_opportunity()
|
||||
self.update_lead()
|
||||
else:
|
||||
frappe.throw(_("Cannot set as Lost as Sales Order is made."))
|
||||
|
||||
@@ -60,11 +66,13 @@ class Quotation(SellingController):
|
||||
|
||||
#update enquiry status
|
||||
self.update_opportunity()
|
||||
self.update_lead()
|
||||
|
||||
def on_cancel(self):
|
||||
#update enquiry status
|
||||
self.set_status(update=True)
|
||||
self.update_opportunity()
|
||||
self.update_lead()
|
||||
|
||||
def print_other_charges(self,docname):
|
||||
print_lst = []
|
||||
|
||||
Reference in New Issue
Block a user