Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odgovori
2229 Prikazi

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


Avatar
Opusti
Avtor Best Answer

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

Avatar
Opusti
Related Posts Odgovori Prikazi Aktivnost
2
okt. 25
2595
1
sep. 25
2589
3
jul. 25
4034
1
maj 25
2138
4
maj 25
3472