Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
4118 Vistas

Hello All, 

I am trying to restrict specific internal users to only see their own clients in contacts.

Avatar
Descartar
Autor Mejor respuesta

1. Create a new group called Extra Rights/Own Contacts where we add the users that we would like to restrict, Select Contact as the model and create an Own Contacts record rule that contains ['|','|',('user_id', '=', user.id),('user_ids','=',user.id),('user_id','=',False)]. Apply Read, Write, Create, and Delete as required. 

2. Create another group called Extra Rights/All Contacts and add the necessary users here who are allowed to see everything. Next search for the record rule called "res.partner.rule.private.employee". Change Group on this from User types / Internal User to the new group Extra Right / All Contacts. 

This step is really important since this rule was initially applied to User types / Internal User groups and every internal user would be a part of this group so it would have overwritten the previous custom record rule and given everyone access to all contacts. 

3) To assign a salesperson, I go to the Sales & Purchase tab on the customer's Contact page, and fill in the Salesperson field.

Note: 

1) It is very important to make sure the Own Contacts users are not a part of the Technical / Access to Private Addresses. 

2) IMPORTANT! Please make sure at least one user in the database is part of Extra Rights/All Contacts and Administration/Settings at all times. Essentially try to inherit the group the admin group of each application. 

3) The above record rule will show users their own contacts along with contacts that do not have a salesperson set on the customer. If you would like to show only the contacts that have a salesperson set use the following record rule instead: 

['|',('user_id', '=', user.id),('user_ids','=',user.id)]


Disclaimer:

Record Rules are always complicated and at times can be tricky to handle. Always try to test it thoroughly before implementing it in production. An incorrect record rule can cause the entire database to break or you might be locked out as well. Please note Odoo is not responsible for any custom record rule made by the user and the user would be in charge of migrating the code during upgrades and debugging issues if any. 

Avatar
Descartar
Mejor respuesta

Hi, I did this for my database and it works perfectly for the contacts module, but I can no longer open the sales app. I get the following error message: 'Due to security restrictions, you do not have access to 'Contact' (res.partner) records.'



How can I solve this?

Avatar
Descartar
Autor

Hello, could you post a screenshot of the entire error you are getting?

Hi Toshan, I added the screenshot in my original comment.

It is a problem with other users' messages in comments. What I don’t know, is how to solve the problem!!!!

Publicaciones relacionadas Respuestas Vistas Actividad
2
may 25
4530
1
abr 25
1273
2
oct 24
4067
1
sept 24
3754
1
sept 24
2480