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.
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.
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.
Hi,
You can create record rules so users can only see contacts, sales, and documents that belong to their own sales team.
Steps
1. 1. Go to: Settings → Technical → Security → Record Rules
2. 2. Create a new rule for each model (e.g., res.partner, sale.order, documents.document).
3. 3. Set the rule domain as shown below:
Rule Domains
For Contacts (res.partner):
['|',
('user_id.sale_team_id.member_ids', 'in', [user.id]),
('sale_team_id.member_ids', 'in', [user.id])]
For Sales Orders (sale.order):
['|',
('user_id.sale_team_id.member_ids', 'in', [user.id]),
('team_id.member_ids', 'in', [user.id])]
For Documents (linked to sales or contacts):
['|',
('partner_id.user_id.sale_team_id.member_ids', 'in', [user.id]),
('sale_order_id.team_id.member_ids', 'in', [user.id])]
4. 4. Apply the rule to the correct user groups, such as “Sales / User: Own Documents Only”.
5. 5. Save and refresh. Users will now only see records belonging to their own sales team.
Hope it helps.
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:
Skapa ett konto idag för att ta del av exklusiva funktioner och engagera dig i vår fantastiska community!
Registrera dig| Relaterade inlägg | Svar | Vyer | Verksamhet | |
|---|---|---|---|---|
|
1
nov. 23
|
3685 | |||
|
1
mars 26
|
979 | |||
|
1
juni 26
|
3862 | |||
|
4
dec. 23
|
26584 | |||
|
1
aug. 22
|
3365 |
1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.