perf: replace if function in query
(cherry picked from commit 5e66231ca4)
This commit is contained in:
@@ -325,10 +325,10 @@ class Project(Document):
|
|||||||
# nosemgrep
|
# nosemgrep
|
||||||
total_billed_amount = frappe.db.sql(
|
total_billed_amount = frappe.db.sql(
|
||||||
"""select sum(base_net_amount)
|
"""select sum(base_net_amount)
|
||||||
from `tabSales Invoice Item` si_item, `tabSales Invoice` si
|
from `tabSales Invoice Item` si_item
|
||||||
where si_item.parent = si.name
|
join `tabSales Invoice` si on si_item.parent = si.name
|
||||||
and if(si_item.project, si_item.project, si.project) = %s
|
where (si_item.project = %s or (si_item.project is null and si.project = %s))
|
||||||
and si.docstatus=1""",
|
and si.docstatus = 1""",
|
||||||
self.name,
|
self.name,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user