How to stop particular user from viewing specific stock entry type?

I have a user who is allowed to make stock transfers, and not allowed to do other entries using the custom script. But I also want to prevent user from viewing the other entry types. Can someone please guide me on what specific code to be added?

I have following script added right now:

frappe.ui.form.on(‘Stock Entry’,‘validate’, function(frm) {
if(frappe.user==‘’ && frm.doc.purpose!=‘Material Transfer’) {
frappe.msgprint(“You are only allowed Material Transfer”);
frappe.throw(__(“Not allowed”));

python script, permission condition filter

Possible to share the script?

It’s hard to provide any guidance given the requirements you have shared so far. If you want high quality answers, ask high quality, thoughtful, detailed questions.

The python script Fisher is talking about can be achieved by overriding the has_permission method in the context of a Doctype Class Override or with a whitelisted function in the has_permission hook like the example given here.

Are you talking about Stock Entry Type?


While making a new entry, I am able to restrict a user by Stock Entry purpose. My issue is I want the use to not be able to view other entry types.

For example, in the below screenshot, I want the user to be able to open “Material Transfer” entry, but prevent him from opening the “Manufacture” entry.

Hi @dextervarun,

Please apply the user permission for the user.

Please apply and check it.

user can only check the Material Transfer.

Thank You!


Worked like a charm. Thanks a ton.