Development Book V17: Hide/View menu based on groups

Managing menu visibility based on user groups is achieved through XML definitions. Let's explore how to hide/view menus and buttons based on groups:

For a button in the header:

<header groups="education_organisation.group_education_organisation_user">
    <button
        groups="education_organisation.group_education_organisation_user"
        name="get_top_score_students"
        string="Get Top Score Students"
        class="oe_highlight"
        type="object"/>
</header>

In this example, the header tag contains a button that is only visible to users belonging to the specific group 'education_organization.group_education_organisation_user'.

For a menu item:

<menuitem    
    id="res_config_settings_menu"   
    parent="config_menu"    
    name="Settings"    
    sequence="10"    
    action="dev_book.res_config_settings_menu_action" groups="education_organisation.group_education_organisation_admin,education_organisation.group_education_organisation_user"
    />

Here, the menuitem tag specifies a menu item with the ID "res_config_settings_menu." The groups attribute is used to indicate the user groups for whom the menu item should be visible. In this case, it will be displayed for users in either the 'education_organization.group_education_organisation_admin' or 'education_organization.group_education_organisation_user' groups.

It's important to note that if you want to designate multiple user groups, you can add each user group category to the groups attribute, separated by commas. This ensures that the menu item is visible to users in any of the specified groups.

whatsapp
location

Calicut

Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635

location

Kochi

Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.

location

Bangalore

Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message