Skip to Content
Menu
This question has been flagged
2 Replies
4419 Views

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
Discard

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
Discard
Author 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
Discard

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

Author

Thank you so much ! it works perfectly

Related Posts Replies Views Activity
1
Oct 23
1235
3
Feb 23
5884
1
Oct 24
2916
0
Aug 19
2016
1
Oct 22
1703