Skip to Content
Menu
This question has been flagged
2 Replies
2580 Views


I want to create rule that will allow user see other users only if his currently picked company is in other users allowed companies.


For example:
UserA have access to Company1 and Company2.
UserB have access to Company1 and Comapny3.
UserC have access only to Company3.


UserA selected Company1 as his current company.
UserB and UserC selected Company3 as their current company.


In the result UserA should see UserB but not UserC. Because UserA have selected Company1 and UserB have Comapny1 in his allowed companies while UserC does not.

Currently users see only other users that have selected the same current company.

I tried to make rule like this:
[('user.company_id.id', 'in', [c.id for c in company_ids])]
then when I'm tring to open users list or even setting odoo crashes and says that "company_ids is not defined".


Avatar
Discard
Best Answer

Hi Andrzej: Check whether the error is being triggered by a typo in "comapny_id" in "user.comapny_id.id"

Avatar
Discard
Author

Unfortunately it does not work (I accidentally removed my previous comment about it)

Author Best Answer

Maybe it is neccessary to modify not only res.users but also res.partner? I tried to turning off completely the record rule for users and it still was restricted to users with the same current company. Only after I turned off the rule for contacts aswell then I could see everyone. So it seems like both models have something to do with it.
Why is that? I tried to open settings and users, not contacts.

How to change both of this rules to make it work?

Avatar
Discard
Related Posts Replies Views Activity
1
Jul 19
2707
0
Feb 19
1242
3
Nov 24
347
0
Nov 24
151
4
Sep 24
1489