Month End Timesheet Restriction

After month end users should not able to able add timesheet in Erpnext V 12. For example if March 21 is over then on 1st April user should not able to add timesheet for March or any previous months.

How we can do this kind of configuration?

We are using version 12 and very soon will migrate to 13.

You can achieve this via server script:

if frappe.utils.getdate().month > frappe.utils.getdate(doc.end_date).month: 
    frappe.msgprint("Cannot submit timesheet for previous month")
    raise frappe.ValidationError

1 Like

Thanks a lot for the help, I have added to our system and will check for May month

To test it quickly you can just create a timesheet with dates set in April.

How to do it if I want to lock it on 25th of every month?