Department wise workflow

I need department wise workflow for ‘material request’ doctype.

User can make material request for any item. He/she will select department and items. Now suppose user select IT department. So this material request will go to only IT manager/IT user. Then he/she will approve this material request.

TIA

I did it successfully.
Here I am describing how to do this

  • Make a workflow
  • must add employee for that particular user which are performed workflow actions (approval/reject…)
  • give a department for every employee user
  • in workflow transition rules go to the row which transition row you want to add department wise restriction
  • click on edit option
  • go to condition section
  • add your condition as requirements -
frappe.db.get_list("Employee", {'department': doc.department, 'user_id': frappe.session.user})

Actually I am doing the same thing I want department wise workflow.

I followed your each step but in mine workflow In the next state options of approve or reject are automatically remove I didn’t find any solution. Please help me in this.

If you have any documentation of your work please share it me. I am very thankful to you.

Will you please share your requirements?

I create a doctype(Complaint). Employee is the person who can create the complaint. My requirement is that if the employee is from from civil department then only that department HOD see the complaint and perform actions on it. Other department HOD will not see that request.

Okay great. My requirement was same.

as a workflow system you can’t restrict users in the workflow system and also you can’t use multiple workflow for the same doctype.

I am using user permission.
suppose my doctype name is ‘workflow test’ and in this doctype I have a field name ‘department’. When a creator creates this doc and put a department then that doc will follow the workflow as the department mentioned.

for this you should create all the possible state and transition in the workflow. see my shared attachment.
each and every user should have different permission as per department.
every transition should have a condition to follow the department wise workflow.

please see the attachment if you can’t understand let me know I will try to explain it more briefly.





@shuvro-baset First i wish to thanking you for giving your valuable time. I seen your all work you explained it very well . Now i am trying it in my system i will notify you if i am get any problem. Thanks for your support.

1 Like

I am getting a problem while adding the user permission. As you wrote your Doctype name in applicable for in advance control in user permission. In my system it not shows my doctype name in dropdown list in applicable for. I tried it by apply to all documents type, but it doesn’t work.

Any suggestion for this.

I am not sure is it version issue or not. I am using version 13. You can uncheck ‘apply to all documents’. then it will show only apply for doctype.

I tried it by apply to all documents it doesn’t work. I am also using the version13. If you get any solution please let me know

There is one another problem that I am facing. My workflow workflow works in the f ollowing manner;

Employee–> HOD–>SDO

I want that SDO only saw the request after the approval of HOD . SDO doesn’t see Employee request unless it is accepted from HOD.

If you have any solution please let me know.

Thanks for your support.

In which module you created the doctype “Workflow Test”.

I am using this for custom app

in that case you can do it using condition. go to transition rules edit option. in the condition section you should add your condition … I am not sure, it will work or not. you can try it.

Make sure that “Department” field is of type “Link”.