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

I know I can completly limit the access to a group with a record like this

<record id="limit_all_access_rule" model="ir.rule">
<field name="name">Limit all access</field>
<field ref="model_my_model" name="model_id"/>
<field name="domain_force">[('state','=','SV')]</field>
<field name="groups" eval="[(4, ref('sales_team.group_sale_salesman'))]"/>
</record>

With this rule the Salesman group can access only the record in the SV state and can't see record in any other state

How can I modify this to make the Salesman group to have readonly access to all record and can write only when in SV state ?



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

You can't do it in a same rule, you need to create two rules:

​ The  Group rules are additive, if any of them matches (and all global rules match) then the record is accessible

 Try the below:


<record id="limit_all_access_rule" model="ir.rule">
<field name="name">Limit all access</field>
<field ref="model_my_model" name="model_id"/>
<field name="domain_force">[('state','=','SV')]</field>
<field name="groups" eval="[(4, ref('sales_team.group_sale_salesman'))]"/>
<field name="perm_read" eval="1"/>
<field name="perm_write" eval="1"/>
<field name="perm_create" eval="0"/>
<field name="perm_unlink" eval="0" />
</record>

<record id="all_read_access_rule" model="ir.rule">
<field name="name">all read access</field> 
<field ref="model_my_model" name="model_id"/>
<field name="domain_force">[(1, '=', 1)]</field>
<field name="groups" eval="[(4, ref('sales_team.group_sale_salesman'))]"/>
<field name="perm_read" eval="1"/>
<field name="perm_write" eval="0"/>
<field name="perm_create" eval="0"/>
<field name="perm_unlink" eval="0" />
</record>

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

Its still not working for me can you provide domain code rather than xml pls

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 1 24
3296
0
thg 1 24
1583
0
thg 2 22
3773
1
thg 4 21
1410
0
thg 4 21
2187