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

Hello,


Is it possible to create a record rule that limits users from seeing partners that belong to users from other sales team.


I only want them to see contacts, sales and documents from the same team that they belong.


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


Restricting Access to Same Sales Team Records in Odoo

You can create record rules to ensure users only see:

Contacts (res.partner)

Sales Orders (sale.order)

Documents (e.g., ir.attachment)

That are assigned to users in the same Sales Team (crm.team) as them.

Example Record Rule Domain:

For res.partner and sale.order:

['|', ('user_id', '=', False),('user_id.sale_team_id', 'in', user.sale_team_id.ids)]

This allows access only if:

The record has no assigned user, OR

The assigned user is in the same sales team


Important points:

  • Adjust domains for documents based on how they're linked (res_model and res_id).
  • Apply rules to appropriate user groups (e.g., Sales / User: Own Documents Only).


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

Yes, this can be done directly in Odoo without custom code.

If each contact, sale order, or document is linked to a Sales Team, and each user is assigned to one or more Sales Teams (under CRM > Configuration > Sales Teams), you can create a Record Rule to restrict access.

Simply go to Settings > Technical > Security > Record Rules (activate Developer Mode if needed), and create a new rule on the relevant model (e.g., res.partner, sale.order, etc.). Use a domain like:

['|', ('team_id.user_id', '=', user.id), ('team_id.member_ids', 'in', [user.id])]

This ensures users only see records related to the Sales Team they belong to.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 11 23
2012
1
thg 7 24
1690
4
thg 12 23
24285
1
thg 8 22
2074
1
thg 10 21
2284