Globalteckz

How to Override Existing Security Groups in Odoo.

  • Home
  • How to Override Existing Security Groups in Odoo.
HOW TO OVERRIDE EXISTING SECURITY GROUPS IN ODOO

How to Override Existing Security Groups in Odoo.

In this tutorial post we will understand how to override existing security groups in Odoo. While creating any custom modules or customize application in Odoo you need to create a new security group along with existing existing group or change the behavior of some existing groups. We will understand both these cases in this blog post but before that understanding what is security groups in Odoo is important

What is Security Groups in Odoo:

what is security groups in odooSecurity groups is one of the most used principles in Odoo. By creating security groups one can define which users should be able to see and access what kind values. Security groups helps you to deny permissions models, to hide menus or to hide fields on views. Now lets start with the tutorial on how to override existing security groups in Odoo ERP software.

As an example we will go through with into the attendance module for this tutorial, currently, the attendance app has 3 user roles.

how to override existing security groups in Odoo ERP

In Odoo, security groups are written in a hierarchical manner and it is compulsory to keep this hierarchy while adding new groups and editing to existing groups.

Below

“Manual Attendance” role has limited access and is the lowest role in the hierarchy.

“Officer” has all access Manual Attendance has along with some additional access.

“Administrator” has full access and is at the top of the hierarchy.

We need to use the field implied_ids inside group definitions to show this hierarchy.

If you check the definition of “Manual attendance” in addons/hr_attendance/security/hr_attendance_security.xml,

You can see there is no implied_ids for this record, implying that this group is at the lowest level of the hierarchy.

implied ids - odoo security groups

Add a new role with access only to the Kiosk mode inside the attendance app. So that this new role will be at the lowest hierarchy below the Manual Attendance.

In our custom module, we can write the code for Kiosk Only role like this

how to overried existing security groups in odoo

Now we will overwrite the existing group “Manual Attendance” and add the implied_ids of the new role to it.

In implied_ids we give our_custom_module_name.id_of_new_role(here hr_attendance_kioskonly.group_hr_attendance_kiosk_only)

While overwriting, remember to add the module name (here hr_attendance) of the group where it originally belongs, to the record id.

how to overried existing security groups in odoo

We will overwrite the root menu of attendance to change it to the group with the lowest hierarchy. so that user can open app

how to override existing security groups in odoo

Finally we will add a new menu for kiosk mode and set the new group as it’s group,

how to override existing security groups in odoo

Now we have a Kiosk only user group, for this we have,

-Created a new group

-Overwrite the existing “Manual Attendance” group

Users with this role can only access Kiosk mode in attendance app

human resource module - how to override existing security groups in odoo

The above screenshots has been taken considering odoo version 13, although for latest version of Odoo ERP software. Somehow the process will be same to follow while overriding existing security groups in Odoo.

About Globalteckz:

At Globalteckz we offer our clients with world class Business and Enterprise solutions. We are presence in India, USA, &  Canada, and have successfully offered end to end solutions to our clients. Some of our services offering include leading Open Source Solutions such as Odoo, Magento, and others ecommerce development. We deliver excellence and quality for Information Technology & Software Solutions to our clients worldwide.

For questions on Odoo pricing and cost that can involve with your business you can contact our sales team on sales@globalteckz.com

Read more articles related to Odoo Pricing :

Leave Comment

×