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

I am wondering how I can set permissions on a field for a specific group ideally through python or xml as it is a custom module. I have a field 'assigned_users' that I need one group to be able to change and write to but for the other group it should be read only. I can't use the group visibility as it still needs to be visible to everyone, just not writable. This could be done by either granting write only to the one group or restricting to read only for the second group, I am just unsure of how this is actually achieved.


Many thanks.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

in the first view you can keep the field as editable then inherit the same view and assign a group to this view and in this inherited view, set the field as read-only, so for use belonging to this group the field will be read-only and for other it will editable.

<record id="view_partner_property_form" model="ir.ui.view">
<field name="name">res.partner.purchase.property.form.inherit</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="priority">36</field>
<field name="groups_id" eval="[(4, ref('base.group_multi_currency'))]"/>
<field name="arch" type="xml">
<group name="purchase" position="inside">
<field name="property_purchase_currency_id" options="{'no_create': True, 'no_open': True}"/>
</group>
</field>
</record>

Thanks

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

Are you sure this is working on v.14 and above?

Till 15.0 this will work and this is not supported in 16

Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 1 16
4358
2
thg 10 20
12517
1
thg 5 23
3920
2
thg 8 20
2879
0
thg 11 15
4674