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

how to make a record readonly by specific user group? 
Example:  I have 10 record of product. and two group of user e.g (A & B). 
here is the requirement

  • users in group A be able to edit all the products

  • user in group B can only edit some specific products

  • user in group B can create products and view all the products

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

Hello CV,
thank you for answering, you mentioned that I have to create a record rule for how many record should be visible.
but how can i create a record rule for the record to be shown but can't be edited?

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

To restrict record rule with more specification give only edit rights into record rule.

ex: add this lines to the record rule

<field name="perm_read" eval="True"/>

<field name="perm_write" eval="False"/>

<field name="perm_create" eval="False"/>

<field name="perm_unlink" eval="False"/>

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

For the security rights you have to assign

 Assign group A with only read permission [1,0,0,0]

Assign group B with all permissions [1,1,1,1]

This permissions are written in ir.model.access.csv file.


For second requirement you have create record rule for group B with the condition for how many records should be visible to particular group.

ex;

 <record id="group_account_invoice" model="res.groups">  
     <field name="name">Billing</field>
     <field name="category_id" ref="base.module_category_accounting_and_finance"/>
     <field name="users" eval="[(4, ref('base.user_root'))]"/>
     <field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
 </record>


For reference see this doc: \https://www.odoo.com/documentation/9.0/reference/security.html

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 3 15
3381
1
thg 3 23
2354
2
thg 9 22
4022
0
thg 3 19
2724
1
thg 3 15
5945