Skip to Content
Menú
This question has been flagged
2 Respostes
3438 Vistes


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
Descartar
Best Answer

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

Avatar
Descartar
Autor

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

Autor 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
Descartar
Related Posts Respostes Vistes Activitat
1
de jul. 19
3619
0
de febr. 19
1839
2
de jul. 25
1666
3
de jul. 25
2097
1
de jul. 25
1416