How to set display depends on the basis of session user role or role profile

We are looking for displays depends based on role or role profile. Is there any evaluation statement that can be written directly without using the server call-back method of the python script? This is not working

eval:frappe.user.has_role(‘Presales User’)

Please suggest , if someone have used it , Thanks

Hi @CA_B.C_Chechani,

Please try it.

eval:frappe.user.has_role('Presales User') == 1

OR

eval:frappe.user.has_role('Presales User') != 1

Then reload and check it.

Thanks.

4 Likes

Thanks a lot, it worked perfectly !

This is one of those mysterious case where it works for someone but not me… :frowning:

Using the condition below in Read Only Depends On, blank in Display Depends On, 0 in Perm Level:

eval:frappe.user.has_role(‘Presales User’) == 1;

Result:

DocField not appearing, and there is a yellow exclamation mark on the left of “eval:”

Using the condition below in Read Only Depends On, blank in Display Depends On, 0 in Perm Level:

frappe.user.has_role(‘Presales User’) == 1;

Result:

DocField appearing, but not Read-Only

Very strange indeed.

I’m on Frappe v13.49.x.