Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
7788 Widoki

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)

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Najlepsza odpowiedź

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.

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
kwi 24
1768
0
wrz 15
5635
1
wrz 22
3748
0
lip 22
1913
0
kwi 20
3059