In the Sales Invoice Doctype, there is a button called “Fetch Timesheet” and when its clicked it pops up as below screenshot. I have been trying to hide it but its still visible.
I apprecaite
This happens a lot of times you may need to do a hard refresh or open in a new browser it should work
That for, you have to hide the project field from the client script because it is in the dialog. otherwise you can override the code using the client script. so please apply the below code and test it.
frappe.ui.form.on("Sales Invoice", {
refresh: function(frm) {
if (frm.doc.docstatus === 0 && !frm.doc.is_return) {
frm.remove_custom_button('Fetch Timesheet');
frm.add_custom_button(__("Fetch Timesheet"), function () {
let d = new frappe.ui.Dialog({
title: __("Fetch Timesheet"),
fields: [
{
label: __("From"),
fieldname: "from_time",
fieldtype: "Date",
reqd: 1,
},
{
fieldtype: "Column Break",
fieldname: "col_break_1",
},
{
label: __("To"),
fieldname: "to_time",
fieldtype: "Date",
reqd: 1,
}
],
primary_action: function () {
const data = d.get_values();
frm.events.add_timesheet_data(frm, {
from_time: data.from_time,
to_time: data.to_time,
project: data.project,
});
d.hide();
},
primary_action_label: __("Get Timesheets"),
});
d.show();
});
}
}
});
Then reload Ctrl+Shift+R and check it.
1 Like
Thats awsome, thank you brother