In real-world business applications, not every menu or button should
be visible to all users. Odoo provides a built-in way to show or
hide UI elements (like menus and buttons) based on user access
groups.
Odoo 18 continues to use the groups attribute in XML views (like Odoo
17), but it improves handling group-based visibility especially when
using OWL components or JavaScript.
Controlling Button Visibility
If you want to show a button only to a specific group of users (like
teachers, managers, etc.), you can use the groups attribute:
<header groups="education_organisation.group_education_organisation_user">
<button
name="get_top_score_students"
string="Get Top Score Students"
class="oe_highlight"
type="object"
groups="education_organisation.group_education_organisation_user"/>
</header>
Here, only users in the group_education_organisation_user will see
this button.
Controlling Menu Visibility
To make a menu item visible only to certain user groups, use groups
in your
<menuitem
id="res_config_settings_menu"
parent="config_menu"
name="Settings"
action="education_organisation.res_config_settings_menu_action"
groups="education_organisation.group_education_organisation_admin,
education_organisation.group_education_organisation_user"/>
The menu will be visible only to users who belong to either the admin
group or the user group of the Education Organisation module, with
multiple groups specified by separating them with commas.