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:
<odoo>
<data>
<record id="grupo_maestros" model="res.groups">
<field name="name">Grupo Maestros</field>
</record>
</data>
</odoo>
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'))]"/>
</record>
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"/>
</tree>
</field>
</record>
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.
Groups and Access Rights in Odoo: http://learnopenerp.blogspot.com/2018/01/groups-and-access-rights-in-odoo.html