mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-09 23:39:28 +00:00
Co-authored-by: Mihir Kandoi <kandoimihir@gmail.com>
This commit is contained in:
@@ -546,8 +546,14 @@ def get_timesheets_list(doctype, txt, filters, limit_start, limit_page_length=20
|
|||||||
customer = contact.get_link_for("Customer")
|
customer = contact.get_link_for("Customer")
|
||||||
|
|
||||||
if customer:
|
if customer:
|
||||||
sales_invoices = frappe.get_all("Sales Invoice", filters={"customer": customer}, pluck="name")
|
sales_invoices = frappe.get_all(
|
||||||
|
"Sales Invoice",
|
||||||
|
filters={"customer": customer, "docstatus": ["!=", 2]},
|
||||||
|
pluck="name",
|
||||||
|
)
|
||||||
projects = frappe.get_all("Project", filters={"customer": customer}, pluck="name")
|
projects = frappe.get_all("Project", filters={"customer": customer}, pluck="name")
|
||||||
|
if not (sales_invoices or projects):
|
||||||
|
return []
|
||||||
|
|
||||||
# Return timesheet related data to web portal.
|
# Return timesheet related data to web portal.
|
||||||
table = frappe.qb.DocType("Timesheet")
|
table = frappe.qb.DocType("Timesheet")
|
||||||
@@ -577,10 +583,7 @@ def get_timesheets_list(doctype, txt, filters, limit_start, limit_page_length=20
|
|||||||
if projects:
|
if projects:
|
||||||
conditions.append(child_table.project.isin(projects))
|
conditions.append(child_table.project.isin(projects))
|
||||||
|
|
||||||
if conditions:
|
return query.where(frappe.qb.terms.Criterion.any(conditions)).run(as_dict=True)
|
||||||
query = query.where(frappe.qb.terms.Criterion.any(conditions))
|
|
||||||
|
|
||||||
return query.run(as_dict=True)
|
|
||||||
else:
|
else:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user