Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
2 Vastaukset
7777 Näkymät

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
Hylkää
Paras vastaus

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
Hylkää
Paras vastaus

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
Hylkää
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
1
huhtik. 24
1763
0
syysk. 15
5632
1
syysk. 22
3742
0
heinäk. 22
1909
0
huhtik. 20
3056