跳至内容
菜单
此问题已终结
2 回复
3452 查看


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".


形象
丢弃
最佳答案

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

形象
丢弃
编写者

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

编写者 最佳答案

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?

形象
丢弃
相关帖文 回复 查看 活动
1
7月 19
3625
0
2月 19
1851
2
7月 25
1711
3
7月 25
2103
1
7月 25
1454