From 114e0db4190cb12964055fcc2fed76c1d7cf49ad Mon Sep 17 00:00:00 2001 From: Pranav Nachnekar Date: Wed, 4 Dec 2019 10:01:43 +0000 Subject: [PATCH] fix: query for finding lost quotation (#19800) * fix: query for finding lost quotation * Update opportunity.py --- erpnext/crm/doctype/opportunity/opportunity.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/erpnext/crm/doctype/opportunity/opportunity.py b/erpnext/crm/doctype/opportunity/opportunity.py index 99486fa206..2880c8050e 100644 --- a/erpnext/crm/doctype/opportunity/opportunity.py +++ b/erpnext/crm/doctype/opportunity/opportunity.py @@ -130,10 +130,10 @@ class Opportunity(TransactionBase): def has_lost_quotation(self): lost_quotation = frappe.db.sql(""" - select q.name - from `tabQuotation` q, `tabQuotation Item` qi - where q.name = qi.parent and q.docstatus=1 - and qi.prevdoc_docname =%s and q.status = 'Lost' + select name + from `tabQuotation` + where docstatus=1 + and opportunity =%s and status = 'Lost' """, self.name) if lost_quotation: if self.has_active_quotation():