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

Hi Odoo Community,

I am now trying to restrict records of surveys for users using Record Rules, for example:

record id 4 only allow user_id 11 and user_id 30 to access

and record id 5 only allow user_id 2 and user_id 20 to access

I can't figure out how to write a proper Record Rule, I can only restrict one record for one user, if I add more users or records, the rule will not work anymore.

Can anybody help me to write a correct Record Rule, please?

Thank you guys!

I am using v16 odoo

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

Updated;

Problem solved:

Record Rule:

[("message_is_follower", "=", True)]

This Record Rule allow only followers access records.

Odoo is powerful.

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

You need to have a field on the survey that can be linked to an attribute for the user.  

For example, each survey could be linked to a customer, and each customer is assigned to a salesman (who is also a user). The salesman can view the surveys related to his/her customers.  

If you can provide more details on what would be on the survey, it may be possible to provide more assistance.

You can also read  more about Record Rules.

[EDIT] You can use followers.  I believe the correct syntax is:

('message_partner_ids', 'in', [user.partner_id.id])

This compares the list of followers (partners) with the partner for the current user.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 1 24
1467
0
thg 12 20
2020
1
thg 9 19
4772
0
thg 6 17
3065
1
thg 10 15
3927