Timesheet filter group projects

Hi,

I’m trying to filter the tasks that can be selected when adding timesheets to only subtasks and not parent type tasks. A parent task being a task that has the is_group checkbox selected.

I’ve tried the following custom script but i can’t seem to make it work. Any ideas are greatly appreciated.

frappe.ui.form.on(‘Timesheet’, {
refresh(frm) {

		frm.fields_dict['task'].grid.get_field('is_group').get_query = function(doc, cdt, cdn) {
    var child = locals[cdt][cdn];
    //console.log(child);
    return {    
        filters:[
            ['task.is_group', '=', 0]
        ]
    }
}

}
})

Thanks

Hoping to get some help - please? Anyone - thanks

Hope this will work for you
frappe.ui.form.on(“Timesheet”, {
setup: function(frm) {
frm.fields_dict[‘time_logs’].grid.get_field(‘task’).get_query = function(frm, cdt, cdn) {
var child = locals[cdt][cdn];
return{
filters: {
‘project’: child.project,
‘is_group’:0
}
}
}
}
})