Merge pull request #22997 from abhishekbalam/set_opportunity_status_to_converted

fix(CRM): Change Opportunity to 'Converted' when Sales Order is created
This commit is contained in:
Deepesh Garg 2020-08-11 16:00:16 +05:30 committed by GitHub
commit 285e059394
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -119,11 +119,19 @@ class Opportunity(TransactionBase):
and q.status not in ('Lost', 'Closed')""", self.name)
def has_ordered_quotation(self):
return 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 = 'Ordered'""", self.name)
if not self.with_items:
return frappe.get_all('Quotation',
{
'opportunity': self.name,
'status': 'Ordered',
'docstatus': 1
}, 'name')
else:
return 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 = 'Ordered'""", self.name)
def has_lost_quotation(self):
lost_quotation = frappe.db.sql("""