跳至内容
菜单
此问题已终结
2 回复
5823 查看

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 !


形象
丢弃

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>

最佳答案

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

形象
丢弃
编写者 最佳答案
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.

形象
丢弃

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

编写者

Thank you so much ! it works perfectly

相关帖文 回复 查看 活动
1
5月 25
2817
3
2月 23
7036
1
4月 25
4710
0
8月 19
2839
1
10月 22
2849