How to Hide Completed and Non Active projects in Timesheet's project fields?

Hi Everyone, how can we hide projects in the timesheet doctype that are completed or cancelled in status and in-active in activity type ? so that employee can’t fill its timesheet.

You can use custom javascript code to apply filter to link field.
Below is sample code.
frappe.ui.form.on(“Timesheet”, “onload”, function(frm) {
frm.set_query(“project”, function() {
return {
“filters”: {
“status”: “Open”,

}
};
});
});

This is not final code. In filters section check the field names which hold status of project in Project doctype