Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
1789 Zobrazení

I am using feature multi company in odoo 16.

I want to block users of one company from being able to view contact lists created by users of other companies. I tried creating a record rule for the contact module that only shows records whose company_id of the user logged into the system matches the company_id of the user whose id equals the create_uid of res_partner.


The domains I use to filter data are as follows:

[ '|', ('create_uid.company_id', '=', user.company_id.id), ('id', '=', user.partner_id.id)]


However it doesn't work as I expected. 

I use userA to create test, odoo auto create new partner name test, and userA's id become test's create_uid. After login odoo with test, i open contacts module and see test's partner. When i open that partner odoo show this error:

Access Error
Due to security restrictions, you are not allowed to access 'Contact' (res.partner) records.

Records: YourCompany, Mitchell Admin (id=3)
User: test (id=8)

This restriction is due to the following rules:
- contact rule

Note: this might be a multi-company issue.

Contact your administrator to request access if necessary.

 

Please let me know if there is any other way that can help me achieve my goal.


Thanks everyone!

Avatar
Zrušit
Nejlepší odpověď

Odoo already has a record rule that will block users in Company A from seeing contacts for Company B.  

You need to specify that the contacts are for Company B (if left blank they are available across all companies):


Avatar
Zrušit
Autor

Thank you, I get it.

Nejlepší odpověď

Hello TrungPA, 


In the case of using the multi-company feature. The company field will be visible in the module. Where you can define the company name. 

So related company users can access the records.


Thanks.

Avatar
Zrušit
Autor

Thank you!

Related Posts Odpovědi Zobrazení Aktivita
0
pro 21
2561
1
bře 21
5755
3
lis 19
3058
2
úno 19
7788
1
bře 24
2084