I would like to restrict Role/User access to different Timesheets based on the current date.
Let’s say I have two Timesheets:
One that is 2 months old and one that is 3 days old.
The Employees should not be able to edit or view the Timesheet that is 2 months old. However, the Employees should still be able to edit the Timesheet that is 3 days old.
Any help is appreciated.
Rule based access is not possible from the front end, as of today. It could be achieved via a custom app and a has_permission hook.
Thank you for your reply.
So per your suggestion, I have been looking into building a has_permission hook. I have a question regarding the code I am trying to build. So this code will be in the timesheet py file and needs to check the dates of each Payroll Period in the Payroll Period doctype. So my question is: is it possible to check the Payroll Period or can you only reference fields and values inside of the Timesheet doctype?
In the hook you can point to any method of your custom app. There you can do anything you want: make API calls, query other values, you name it…