Odoo Help


How can I allow access to specific views for a group?

on 5/16/18, 12:18 PM 500 views

Hello. I´m trying to allow access to a group of users that I created, but I can´t know how to give access rights.
I have a group maker /security/groups.security.xml with this code that works:


<record id="grupo_maestros" model="res.groups">
<field name="name">Grupo Maestros</field>

In other file, in /security/aula10.security.xml I have the specific records for rules:

<record id="regla_alumnos" model="ir.rule">
<field name="name">alumnos</field>
<field name="model_id" ref="model_aula10_alumno"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True" />
<field name="perm_unlink" eval="True" />
<field name="groups" eval="[(4,ref('grupo_maestros'))]"/>

And for the view aula10_alumno I added the group to menuitem:

<menuitem name="Alumnos" id="alumnos" groups="grupo_maestros" sequence="10" action="alumno_action"/>

and for the specific tree view:

<record model="ir.ui.view" id="alumno_tree_view">
<field name="name">alumno.tree.view</field>
<field name="model">aula10.alumno</field>
    <fieldname="groups_id"eval="[(4, ref('grupo_maestros'))]"/>
<field name="arch" type="xml">
<tree string="Alumnos">
<field name="foto_nino" widget="image" img_width="35" />
<field name="name"/>
<field name="primer_apellido"/>
<field name="segundo_apellido"/>
<field name="fecha_nacimiento"/>
<field name="lugar_nacimiento"/>

The problem is that when I see from Odoo in the group, the menus, the views and rules appears, but i haven´t had
nothing in the access rights section.
I think this is the cause because the user "Trini", that is in "grupo_maestros", can´t see the "alumno" menuitem. I think if the access rights are empty, even having menus rights, the menu not appears.

Can you explain me how to give these access rights with code? I know that I can do the same via Odoo interface, but is important perform this by code.
Thanks for your help.

On 5/17/18, 5:23 AM

The most significant area in Odoo/OpenERP is how to deal or manage users. Managing users and assigning groups or role is the key point in every business. In Odoo/OpenERP assigning role or group to the single user is made through Administrator. And its not a good practice to do so using login through admin and do some setting stuff like assigning groups to employee or users.

Get complete code and description: http://learnopenerp.blogspot.com/2018/01/groups-and-access-rights-in-odoo.html


Hilar AK

--Hilar AK--
--Hilar AK--



Experienced Odoo developer, Functional Consultant. Happy to help in the development and also functional consultation.

Hilar AK
On 5/17/18, 1:26 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 5/16/18, 12:18 PM
Seen: 500 times
Last updated: 5/17/18, 5:23 AM