Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
4 Trả lời
31115 Lượt xem

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.


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Under security folder you should create a csv file and give access right for that group like this

     id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink

     access_project_project,project.project,project.model_project_project,group_project_developers,1,0,0,0

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Have look here

http://www.odoo.yenthevg.com/creating-security-groups-odoo/

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 7 23
4679
1
thg 2 23
1719
2
thg 9 19
3742
1
thg 7 19
9694
1
thg 7 19
4698