Leave Application Workflow Question

Why ERPnext doesn’t depends on frappe workflow?

In HR → Leave Application, it works depending on select tag called status [ open,approved,reject]

My Question is, Which one is better than, to use frappe workflow or to use select status tag like Leave application?

@mostafa, ERPNext doesn’ depends of frappe workflow, because the workflow was released late, if compared with the set of features of ERPNext. Another detail is, Workflows are not for core-features, if you need a strict workflow, it should be managed by code, instead a group or rules, that any user can easily change.

Workflows are about the customization of a standard product, to fit a business reality!

I do a workflow and some validation from code to strict that, like the following:

For example : Leave Application workflow
1- Employee → Applied
2- Applied → Pending Department Manager
3- Pending Department Manager → Pending Administrator
4- Pending Administrator → Approved

Now if Employee has available days that not allocated the department manager can change the status to Approved directly which is the last step without go to the Administrator, if not the workflow works normally.

is this the right way to implement that, or I have to make it fully from the code?

@mostafa, usually we dont ensure business rules inside workflows, due the user can change the workflow!

I ever will prefer implement it by code, due code is durable, and workflows not!

1 Like

What If the Administrator just can edit the workflow is that make sense?

Or the workflow will be meaning less because the code restriction.

@mostafa, the issue here is, you will have a business logic, based on one thing that change!

You can, define that only Administrator can change the workflow, but lets suppose, that ERPNext deprecate Workflows what do you will do? Rework?

1 Like

Yes, I understood
Thank you very much :smile:

@mostafa, my proposal!

If do you want go ahead with workflows, do a validation inside the workflow too, to ensure that all states are in the workflow after a change!

That what I have now validation and workflow states.

Ooh Ooh
You made me confused again

I actually validate my case, and it works good using workflow.
the only thing that I have done with some confusing is I convert the document to submitted after employee send the request to the manager directly, in step number 1, and I did that to let the department manager reject that, because the you cant reject without docstatus = 1

@mostafa, I’m talking about, do a validation inside the “Workflow” DocType, to ensure:

That if have all states that your code need!

Will be a bit crapy, due a new Workflow, requires a lot of conditional blocks in the workflow validation.