Hiding a entire tab in role base access

Hello i want a tab to be hidden from users but they should still have read and write access on the tab but it should be hidden

1 Like



You can set display depends on(js) like this

eval: frappe.user.has_role("~~~ User")
2 Likes

The tabs will be visible to users in the role (display depends on js) but all the users will have edit access to the fields though the tab is hidden. Right ?

1 Like

Yes. Right.

Display Depends On only functions whether it is visible or not on the screen.
Set Display Depends On and test the behavior what you want.

2 Likes

Thank you so much , can i set more than one role in this for example
eval: frappe.user.has_role(“~~~ User, User 2”)

1 Like

Of course.

You can use like this.

eval: frappe.user.has_role(["Accounts User", "Accounts Manager"])

CleanShot 2024-11-04 at 15.42.39

you can find example code at frappe/public/js/frappe/utils/user.js

3 Likes

Thanks !

2 Likes