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

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 !


Ảnh đại diện
Huỷ bỏ

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>

Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất
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.

Ảnh đại diện
Huỷ bỏ

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

Tác giả

Thank you so much ! it works perfectly

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 5 25
2495
3
thg 2 23
6777
1
thg 4 25
4372
0
thg 8 19
2644
1
thg 10 22
2596