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

Hello everyone,

I developed a website using Odoo website, and in this website I have a list of all the companies and I should access to the details, (when I click on the company card) just to display some details about this company.

but as a connected user who is not a member of the company, not an employee of this company just accessing this route is denied, here is the route:

@http.route('/company_details/model(res.company):lab",type='http', auth="public",website=True)

and here is the error:

Due to security restrictions, you are not allowed to access 'Companies' (res.company) records.
Records: False (id=37)
User: test (id=19)
This restriction is due to the following rules:
- company rule employee
Note: this might be a multi-company issue.
Contact your administrator to request access if necessary.

do you have any idea, how can I solve this? Thank you

N: Please don't mind the syntaxe of the route, I had to write it that way to be able to post this question


Аватар
Відмінити
Автор Найкраща відповідь

The solution is to add a security rule to all everyone to read res.company

id="everyone_can_read_companies" model="ir.rule">
name="name">everyone can read companies
name="model_id" ref="model_res_company"/>
name="domain_force">['!',('id', 'in', user.company_ids.ids)]

name="groups" eval="[(4, ref('base.group_user')), (4, ref('base.group_public')), (4, ref('base.group_portal'))]"/>

name="perm_read" eval="True"/>
name="perm_write" eval="False"/>
name="perm_create" eval="False"/>
name="perm_unlink" eval="False"/>

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
2
жовт. 25
2596
1
вер. 25
2592
3
лип. 25
4035
1
трав. 25
2139
4
трав. 25
3473