Timesheet workflow questions

Howdy

I am wanting to setup a workflow on the Timesheet document type to enable an approval workflow very similar to that of the expense claim document type. Here is the workflow document I have setup:

image


I customized the form and added the “approval status” field. I also added a “timesheet approver” link field to the user document.

Here are my questions/issues:

  • The timesheet approver field is not filtered to only show those users with the project manager role, but instead shows all users. Right now my workaround is to set the default value of the field to the person who will approve timesheets, but this is not really scalable. How does ERPNext do the filter in the expense claim document? I thought it was off of the workflow, but apparently not.
  • When a sample timesheet is rejected, the workflow status is going to rejected and the document stays submitted and I cannot cancel it. I have setup in the workflow to set the status to pending and it works this way on my expense claim workflow, but for some reason is not on timesheet. Any ideas why?
  • Approved documents cannot be canceled and deleted. There is no way to clear out my tests that I can find. I understand that once a TS is associated with a salary slip that it can’t be deleted, but right now that is not the case.

Thanks in advance

1 Like

They set query to approver field,

https://github.com/frappe/erpnext/blob/develop/erpnext/hr/doctype/expense_claim/expense_claim.js#L57-L61

you have to set Doc Status 2 for Pending State to Cancel the Document on Reject.

So there is custom code on the expense claim. Interesting. I would have expected that code to be generated from the workflow somehow.

A timesheet that has been “submitted for approval” is not really submitted from an ERP perspective. The employee can actually still edit the document if they want (another thing I want to change), so when the status goes from submitted for approval to rejected the document should still be a 0 and not a 2 status. The workflow I have on expense claim looks identical and it works there, so not sure why it doesn’t work on timesheet.

I created this git issue to help with this stuff

https://github.com/frappe/erpnext/issues/11493

I am testing ERPNext and created a workflow for leave management. I have the same requirements (set an approver to the employee’s manager, filter the users according the role specified in the “Only Allow Edit For” field0. Just to revive this topic, as I guess the issue has not been resolved yet.

Regards.

This is our solution to approving time sheets. “Zeiterfassungs…” is a custom role we created just for this purpose.