From d44af308164115e8334446f0b5cf8afda261f359 Mon Sep 17 00:00:00 2001 From: "Abdelouahab (abla)" Date: Tue, 22 Mar 2022 09:56:05 +0000 Subject: [PATCH] [FIX] hr : fixing access rule to be able to update its own res users record To reproduce ============ - Connect with Mitchell Admin - Go to Employee -> Settings and uncheck "Skills Management" - Go to Settings -> Users, create a user "Test" and give him access to 2 companies (e.g. My Company [San Fransisco] and My Company [Chicago]) - Set current company to My Company [San Fransisco], go to Employees, create an employee record and associate it with your test user (in HR Settings tab) - Set current company to My Company [Chicago] and create another employee and associate it with your test user too - Connect as "test" user and go to my profile - Try to change your langage (From English US to French) ==> Access rights error Purpose ======= When the `OnChange` is triggred we try to read the two employees linked to this user, but one of this employees is in unslected company which leads to Access rights error. Specification ============= To solve the issue the domain in the security rule **Employee multi company rule** has been updated, where we added the condition `('user_id', '=', user.id)` which gives the user the ability to read the needed data. opw-2793123 closes odoo/odoo#87244 X-original-commit: 5916e15f6fa29fd89e12472b316475e757001945 Signed-off-by: Kevin Baptiste --- addons/hr/security/hr_security.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr/security/hr_security.xml b/addons/hr/security/hr_security.xml index c84300e0502..aa646fb1df3 100644 --- a/addons/hr/security/hr_security.xml +++ b/addons/hr/security/hr_security.xml @@ -41,7 +41,7 @@ Employee multi company rule - ['|',('company_id','=',False),('company_id', 'in', company_ids)] + ['|','|',('user_id', '=', user.id),('company_id', '=',False),('company_id', 'in', company_ids)]