Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
7786 Visualizzazioni

Actually I'm creating a two rules for employees groups and one for manager group

For manager:

 <record model="ir.rule" id="employee_view_rule_manager">
            <field name="name">Manager view rule</field>
            <field name="model_id" ref="hr.model_hr_employee"/>
            <field name="groups" eval="[(4, ref('hr.group_hr_manager'))]" />
            <field name="domain_force">[(1,'=',1)]</field>
        </record>


For employees:

<record model="ir.rule" id="employee_view_rule_employee">
            <field name="name">Employee view rule</field>
            <field name="model_id" ref="hr.model_hr_employee"/>
            <field name="groups" eval="[(4, ref('base.group_user'))]" />

            <field name="perm_create" eval="False"/>

            <field name="domain_force">[('user_id', '=', user.id)]</field>
        </record>

whenever i login as a employee its show only my record that's good but i can not access it its give me an error

The requested operation cannot be completed due to security restrictions. Please contact your system administrator.

(Document type: hr.employee, Operation: read)

Avatar
Abbandona
Risposta migliore

Hi Gagandeep,

It looks like there is a missing security rule for hr.employee. If you can reproduce this on a default Odoo test instance (at runbot.odoo.com) without custom development you should report it as a bug.
The easiest way to solve this is to make a new security rule that gives read operations on the model hr.employee:

hr_employee_read, hr employee read rights,model_hr_employee,,1,1,1,1
// or if you want to apply it to one specific group of users (for example your base.group_user):
hr_employee_read, hr employee read rights,model_hr_employee,base.group_user,1,1,1,1

Regards,
Yenthe

Avatar
Abbandona
Risposta migliore

The problem here is the Organization Chart in form of an Employee. It requires at least 'read' permission to see the information of the employee's boss (parent_id).

In your case, a normal Employee only sees themself and has no permission to see the information of their boss (other employees). So that, it will raise Permission Error as you described in your question.

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
1
apr 24
1768
0
set 15
5635
1
set 22
3747
0
lug 22
1913
0
apr 20
3059