Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
2 Відповіді
3516 Переглядів


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?

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
1
лип. 19
3639
0
лют. 19
1921
2
лип. 25
1779
3
лип. 25
2174
1
лип. 25
1489