All employees need to submit the timesheet by day end. If not submitted, then the system will restrict & will not allow submitting the next day
(For next-day submission, rights need to be given only to System manager)
All employees need to submit the timesheet by day end. If not submitted, then the system will restrict & will not allow submitting the next day
(For next-day submission, rights need to be given only to System manager)
Please apply the custom/client script.
frappe.ui.form.on("Timesheet", "validate", function(frm) {
if (frappe.user_roles.indexOf("System Manager")==-1) {
var date = new Date(frm.doc.creation).toISOString().slice(0,10);
if (date < get_today()) {
frappe.msgprint(__("You can not submit the timesheet."));
frappe.validated = false;
}
}
});
Then reload and check it.
Thank You!
I have needed submit event not save
Then apply it and check.
frappe.ui.form.on("Timesheet", "validate", function(frm) {
if (frappe.user_roles.indexOf("System Manager")==-1) {
if (!frm.doc.__islocal) {
if (frm.doc.docstatus != 1) {
var date = new Date(frm.doc.creation).toISOString().slice(0,10);
if (date < get_today()) {
frappe.msgprint(__("You can not submit the timesheet."));
frappe.validated = false;
}
}
}
}
});