Enable Dark Mode!
how-to-create-security-groups-in-odoo-15.jpg
By: Sayanth MK

How to Create Security Groups in Odoo 15

Technical Odoo 15

When it comes to security in Odoo, security groups are crucial. Odoo includes several security measures for user roles, all of which are implemented in the Odoo Server. The lowest server level, the ORM engine, is that they're implemented. Odoo distinguishes between the following concepts:

A group is a collection of users who share some access permissions. The assets of a group are available to persons who are members of a group. Like Manager, advisor, and so forth.

A security rule specifies the access permissions that a group grants to its members. A resource, such as an Invoice model, has security rules connected to it.

Let's develop the security groups for the custom module over time in this blog.

<record model="ir.module.category" id="overtime_module_management">
             <field name="name">Overtime</field>
             <field name="description">User access levels for Overtime module</field>
             <field name="sequence">10</field>
        </record>

Let's go on to the next stage, which is to add the security group so that the user can choose their access permissions.

<record id="overtime_user_access" model="res.groups">
            <field name="name">User</field>
            <field name="category_id" ref="overtime_module_management"/>
        </record>
        <record id="overtime_manager_access" model="res.groups">
            <field name="name">Manager</field>
            <field name="category_id" ref="overtime_module_management"/>
            <field name="implied_ids" eval="[(4, ref(overtime_user_access))]"/>
        </record>

As a result, the preceding code will assist in the creation of a security group for both the user and the manager.

We mention the name of the security group and the category id to which they belong when creating the user's group. We previously established the category above, so we only need to provide the category's ID. We've supplied the name and category ID for the manager, just as we did for the user, but we've also given the implied ids, which is the implied ID for the user security group. This means that the manager will have access to the user's rights as well.

So, in debug mode, if you go to the general settings menu item and choose Users & Companies, you'll see a menu item named groups.

how-to-create-security-groups-in-odoo-15-cybrosys

All of the security groups that have been formed may be found under the menu option 'groups'.

how-to-create-security-groups-in-odoo-15-cybrosys

You can see the groups shown under the category Overtime in the user's preferences, and we can pick the security group for the users.

how-to-create-security-groups-in-odoo-15-cybrosys

We don't always want to reveal certain menu options to users. By adding groups to the Menu item, we can indicate the group for whom the menu item should be displayed.

<menuitem name="Overtime"
                  id="overtime.menu_1"
                  parent="overtime.menu_root"
                  action="action_window"
                  groups="overtime_manager_access"/>

Users in the overtime_manager_access security group will only see the menu option.


If you need any assistance in odoo, we are online, please chat with us.



0
Comments



Leave a comment

 


whatsapp_icon
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