Skip to content

Commit

Permalink
[FIX] hr: Multi company issue with hr.employee
Browse files Browse the repository at this point in the history
Steps to reproduce the bug:
- Set your user in multi company
- Create two companies C1 and C2 where C2 is a child of C1
- Create a job position JP in company C2
- Create an employee E in company C2
- Log in company C1
- Try to archive E

Bug:

An access error was raised due to ir.rule "Job multi company rule" saying that
you can only see the job position in your company or in your company's childs.

The same logic must be applied for the hr.employee to avoid access rights error
in multi company.

opw:2044018

closes odoo#35370

Signed-off-by: Simon Goffin (sig) <[email protected]>
  • Loading branch information
simongoffin committed Aug 1, 2019
1 parent df58958 commit 7b1a894
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions addons/hr/security/hr_security.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,12 @@
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>

<record id="hr_employee_comp_rule" model="ir.rule">
<field name="name">Employee multi company rule</field>
<field name="model_id" ref="model_hr_employee"/>
<field name="global" eval="True"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>

</data>
</odoo>

0 comments on commit 7b1a894

Please sign in to comment.