From 2b65b22aa2d9fd6d7ff4b407ecd1bd01f4bc43fa Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Mon, 7 Nov 2022 22:48:52 +0530 Subject: [PATCH] fix: Project filter in timesheet --- .../projects/doctype/timesheet/timesheet.js | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/erpnext/projects/doctype/timesheet/timesheet.js b/erpnext/projects/doctype/timesheet/timesheet.js index e1486de18c..a376bf46a5 100644 --- a/erpnext/projects/doctype/timesheet/timesheet.js +++ b/erpnext/projects/doctype/timesheet/timesheet.js @@ -92,18 +92,26 @@ frappe.ui.form.on("Timesheet", { frm.fields_dict["time_logs"].grid.toggle_enable("billing_hours", false); frm.fields_dict["time_logs"].grid.toggle_enable("is_billable", false); } + + let filters = { + "status": "Open" + }; + + if (frm.doc.customer) { + filters["customer"] = frm.doc.customer; + } + + frm.set_query('parent_project', function(doc) { + return { + filters: filters + }; + }); + frm.trigger('setup_filters'); frm.trigger('set_dynamic_field_label'); }, customer: function(frm) { - frm.set_query('parent_project', function(doc) { - return { - filters: { - "customer": doc.customer - } - }; - }); frm.set_query('project', 'time_logs', function(doc) { return { filters: {