I am writing this code in a child table named Timesheet Detail, which belongs to the parent doctype Timesheet . The field name for this child table in the parent doctype is time_logs. In this child table, there are two fields: activity_type and task. I want to set a filter on the task field. but its not working . How to set filter for task field .
frappe.ui.form.on(‘Timesheet’, {
employee(frm) {
console.log(‘hi’)
}
});
frappe.ui.form.on(‘Timesheet Detail’, {
activity_type: function(frm, cdt, cdn) {
var data = [“Task 1”, “Task 2”];
frm.fields_dict['time_logs'].grid.get_field('task').get_query = function() {
return {
filters: {
name: ['in', data]
}
};
};
frm.refresh_field('time_logs');
}
});