Skip to Content
Menu
This question has been flagged
2 Replies
6406 Views

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
Discard
Best Answer

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
Discard
Best Answer

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
Discard
Related Posts Replies Views Activity
1
Apr 24
418
0
Sep 15
4621
1
Sep 22
2051
0
Jul 22
1081
0
Apr 20
2389