İçereği Atla
Menü
Bu soru işaretlendi
2 Cevaplar
7789 Görünümler

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
Vazgeç
En İyi Yanıt

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
Vazgeç
En İyi Yanıt

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
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
1
Nis 24
1770
0
Eyl 15
5635
1
Eyl 22
3748
0
Tem 22
1914
0
Nis 20
3059