Skip to Content
Menú
This question has been flagged
2 Respostes
5542 Vistes

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>

Best Answer

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 Best Answer
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

Related Posts Respostes Vistes Activitat
1
de maig 25
2467
3
de febr. 23
6758
1
d’abr. 25
4354
0
d’ag. 19
2630
1
d’oct. 22
2581