Restricting Sale Order List view using a custom field to a certain role

I need some assistance. I have added a custom field on sales order called type that has different types of orders eg Drug Orders, Lab Orders etc. I have created a role called pharmacy. How do I restrict pharmacy to only view Drug orders and not any other order. I would like when a Pharmacy user logs in to see information that is only theirs i.e Drug orders on the sales order and not any other type of sales order. Kindly assist. Will appreciate. Tried permissions and its not working

1 Like

You need field level permission for this. This is exactly what you need https://erpnext.org/docs/user/manual/en/setting-up/articles/managing-perm-level

If you still need assistance, let me know.

Thanks for replying …I think this just restricts a users access to a field. What I want to acheive is when I login as a pharmacist I can only see Pharmacy related sales orders not everything on the sales orders list

ohh my bad. I misinterpreted your question. For that you need Role based User permission on sales order doctype. Can you post screenshot of your role based user permission of sales order doctype, I can help more by seeing it.

Okay a minute

Its a good idea to hide things which could lead to security issues before sending a screenshot like Url and other things.

That is a test environment …but thanks…

1 Like

Hi here is my permission

which version of ERPNext are you on ?

version v11

ok. I understand that in v11, method to set User based permission on doctype has been changed ( to simplify ) the process. I am yet to play around with v11 so dont know exact details about it, may be someone else can help on this.

ERPNext - User Permissions Updates in V11 - Webinar - YouTube See if this helps.

My suggestion is you should make separate doctype for “Order Type” and add custom field in sales order which you already did i think. After that you should set role permission like doctype=“sales order” , role=“Pharmacy” and check “apply user permission” and select “order type” is permitted and then add user permission for order type to every pharmacy role user.

1 Like

Thanks a lot :slight_smile:

Kindly clarify further …I am a bit lost if you don’t mind

what he means to say is - the custom field which you made should be another doctype for you to create user permissions based on that field. Am I right @Maheshwari_Bhavesh?

Okay let me try that. Will get back to you guys if it works hope you will be available to assist if I hit a dead end. Thanks a lot

Step 1:make order doctype

step 2: add custom field in sales order like below:

step 3: add user permission for user …

step 4:Set role permission for sales order and pharmacy role like below…

4 Likes

Thanks brother let me implement the same … let you know

Worked :slight_smile:

fine…