Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
5816 Vistas

Hello,

I want to make a control invisible for users of only 1 group. All users of other groups have the right to access this field. I know how to do the opposite, that is to say, restrict access to the field to 1 group. But this way the list will be very long if I have to put all the groups. Is there a simple method, preferably with Odoo Studio?

Thanks in advance !


Avatar
Descartar

I worked on hiding field for specific group by inherit the view as below:

<record id="purchase_order_form_access_group" model="ir.ui.view">
<field name="name">purchase.order.form.access.group</field>
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase.purchase_order_form" />
<field name="groups_id" eval="[(6, 0, [ref('YOUR_GROUP_YOU_WANT_THE_FIELD_TO_BE_INVISIABLE') ])]"/>
<field name="arch" type="xml">
<field name='name' position="attributes">
<attribute name="invisible">1</attribute>
</field>
</field>
</record>

Mejor respuesta

Hi,

Create an inherited view of this view, set user group(group for which field has to be invisible) for the view and in this view, make the field invisible.

So end result will be, field wont be visible for the users in the given group.

See this: https://www.youtube.com/watch?v=Fsp6lAPHz08

Thanks

Avatar
Descartar
Autor Mejor respuesta
Thank you for that answer. I didn't want to go through any code, is it possible to do it from the administration interface? Or Studio?

Through the administration interface, we can inherit a view. But I don't see or indicate the groups like here in code:



Thanks.

Avatar
Descartar

the explained thing in the answer can be done from ui also, create a inherited view from ui, and assign group for that view(it can be done from ui), if you open view record, you can see a tab named Access rights

Autor

Thank you so much ! it works perfectly

Publicaciones relacionadas Respuestas Vistas Actividad
1
may 25
2807
3
feb 23
7024
1
abr 25
4700
0
ago 19
2827
1
oct 22
2840