Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
1 Antworten
2251 Ansichten

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
Verwerfen
Autor Beste Antwort

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
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
2
Okt. 25
2598
1
Sept. 25
2599
3
Juli 25
4037
1
Mai 25
2144
4
Mai 25
3475