From efb6482ef64bb53a73eee60458c490935a7ee8ba Mon Sep 17 00:00:00 2001 From: Lokesh Waingankar Date: Thu, 27 Feb 2020 19:08:58 +0530 Subject: [PATCH 1/3] fix: user is not able to do 'Set as Lost' for Quotation (#20689) --- erpnext/selling/doctype/quotation/quotation.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py index d8667f603a..8ec2b76db9 100644 --- a/erpnext/selling/doctype/quotation/quotation.py +++ b/erpnext/selling/doctype/quotation/quotation.py @@ -68,13 +68,19 @@ class Quotation(SellingController): def declare_enquiry_lost(self, lost_reasons_list, detailed_reason=None): if not self.has_sales_order(): + get_lost_reasons = frappe.get_list('Opportunity Lost Reason', + fields = ["name"]) + lost_reasons_lst = [reason.get('name') for reason in get_lost_reasons] frappe.db.set(self, 'status', 'Lost') if detailed_reason: frappe.db.set(self, 'order_lost_reason', detailed_reason) for reason in lost_reasons_list: - self.append('lost_reasons', reason) + if reason.get('lost_reason') in lost_reasons_lst: + self.append('lost_reasons', reason) + else: + frappe.throw(_("Invalid lost reason {0}, please create a new lost reason".format(reason.get('lost_reason')))) self.update_opportunity() self.update_lead() From d398c73bc551ac3c349134fd0b2ca565a7cfe97a Mon Sep 17 00:00:00 2001 From: Lokesh Waingankar Date: Tue, 3 Mar 2020 19:07:51 +0530 Subject: [PATCH 2/3] fix: Removed html tags in pop up message (#20603) --- erpnext/selling/doctype/quotation/quotation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py index 8ec2b76db9..53e5d35db6 100644 --- a/erpnext/selling/doctype/quotation/quotation.py +++ b/erpnext/selling/doctype/quotation/quotation.py @@ -80,7 +80,7 @@ class Quotation(SellingController): if reason.get('lost_reason') in lost_reasons_lst: self.append('lost_reasons', reason) else: - frappe.throw(_("Invalid lost reason {0}, please create a new lost reason".format(reason.get('lost_reason')))) + frappe.throw(_("Invalid lost reason {0}, please create a new lost reason".format(frappe.bold(reason.get('lost_reason'))))) self.update_opportunity() self.update_lead() From 6d604a151b1028bde21ee1c3bb974eab46e957b5 Mon Sep 17 00:00:00 2001 From: Deepesh Garg <42651287+deepeshgarg007@users.noreply.github.com> Date: Wed, 4 Mar 2020 11:55:10 +0530 Subject: [PATCH 3/3] fix: Validation message --- erpnext/selling/doctype/quotation/quotation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py index 53e5d35db6..b79c91cef1 100644 --- a/erpnext/selling/doctype/quotation/quotation.py +++ b/erpnext/selling/doctype/quotation/quotation.py @@ -80,7 +80,7 @@ class Quotation(SellingController): if reason.get('lost_reason') in lost_reasons_lst: self.append('lost_reasons', reason) else: - frappe.throw(_("Invalid lost reason {0}, please create a new lost reason".format(frappe.bold(reason.get('lost_reason'))))) + frappe.throw(_("Invalid lost reason {0}, please create a new lost reason").format(frappe.bold(reason.get('lost_reason')))) self.update_opportunity() self.update_lead()