mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-15 23:48:38 +00:00
Co-authored-by: Raffael Meyer <14891507+barredterra@users.noreply.github.com>
This commit is contained in:
@@ -285,7 +285,11 @@ class Opportunity(TransactionBase, CRMNote):
|
|||||||
if not self.get("items", []):
|
if not self.get("items", []):
|
||||||
return frappe.get_all(
|
return frappe.get_all(
|
||||||
"Quotation",
|
"Quotation",
|
||||||
{"opportunity": self.name, "status": ("not in", ["Lost", "Closed"]), "docstatus": 1},
|
{
|
||||||
|
"opportunity": self.name,
|
||||||
|
"status": ("not in", ["Lost", "Cancelled", "Expired"]),
|
||||||
|
"docstatus": 1,
|
||||||
|
},
|
||||||
"name",
|
"name",
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
@@ -294,14 +298,20 @@ class Opportunity(TransactionBase, CRMNote):
|
|||||||
select q.name
|
select q.name
|
||||||
from `tabQuotation` q, `tabQuotation Item` qi
|
from `tabQuotation` q, `tabQuotation Item` qi
|
||||||
where q.name = qi.parent and q.docstatus=1 and qi.prevdoc_docname =%s
|
where q.name = qi.parent and q.docstatus=1 and qi.prevdoc_docname =%s
|
||||||
and q.status not in ('Lost', 'Closed')""",
|
and q.status not in ('Lost', 'Cancelled', 'Expired')""",
|
||||||
self.name,
|
self.name,
|
||||||
)
|
)
|
||||||
|
|
||||||
def has_ordered_quotation(self):
|
def has_ordered_quotation(self):
|
||||||
if not self.get("items", []):
|
if not self.get("items", []):
|
||||||
return frappe.get_all(
|
return frappe.get_all(
|
||||||
"Quotation", {"opportunity": self.name, "status": "Ordered", "docstatus": 1}, "name"
|
"Quotation",
|
||||||
|
{
|
||||||
|
"opportunity": self.name,
|
||||||
|
"status": ("in", ["Ordered", "Partially Ordered"]),
|
||||||
|
"docstatus": 1,
|
||||||
|
},
|
||||||
|
"name",
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
return frappe.db.sql(
|
return frappe.db.sql(
|
||||||
@@ -309,7 +319,7 @@ class Opportunity(TransactionBase, CRMNote):
|
|||||||
select q.name
|
select q.name
|
||||||
from `tabQuotation` q, `tabQuotation Item` qi
|
from `tabQuotation` q, `tabQuotation Item` qi
|
||||||
where q.name = qi.parent and q.docstatus=1 and qi.prevdoc_docname =%s
|
where q.name = qi.parent and q.docstatus=1 and qi.prevdoc_docname =%s
|
||||||
and q.status = 'Ordered'""",
|
and q.status in ('Ordered', 'Partially Ordered')""",
|
||||||
self.name,
|
self.name,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user