From ac80ba9bcf87757ee90aeae582244958effdd1cb Mon Sep 17 00:00:00 2001 From: zel-odoo Date: Fri, 15 Mar 2024 13:24:03 +0100 Subject: [PATCH] [FIX] hr: be able to see profile button correctly Currently, when the user and the target both are in multiple companies, the profile button cannot be displayed correctly. Since the employee_id uses `('company_id', '=', self.env.company.id)` rather than `in`. This commit fixes the issue by checking employee_ids directly and if it is found, the profile button will be displayed correctly. We don't care about which employee_id is used if there are multiple, since the user are in multiple companies as well. If looking for a specific profile, the employee can be found in the HR application. closes odoo/odoo#157741 Signed-off-by: Sofie Gvaladze (sgv) --- .../src/components/avatar_card/avatar_card_popover_patch.js | 4 ++-- .../src/components/avatar_card/avatar_card_popover_patch.xml | 2 +- addons/hr/static/tests/web/m2x_avatar_user_tests.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/hr/static/src/components/avatar_card/avatar_card_popover_patch.js b/addons/hr/static/src/components/avatar_card/avatar_card_popover_patch.js index bc0ecf571fc..409512894b7 100644 --- a/addons/hr/static/src/components/avatar_card/avatar_card_popover_patch.js +++ b/addons/hr/static/src/components/avatar_card/avatar_card_popover_patch.js @@ -18,7 +18,7 @@ export const patchAvatarCardPopover = { "job_title", "department_id", "employee_parent_id", - "employee_id", + "employee_ids", ]) }, get email(){ @@ -28,7 +28,7 @@ export const patchAvatarCardPopover = { return this.user.work_phone || this.user.phone; }, async onClickViewEmployee(){ - const employeeId = this.user.employee_id[0]; + const employeeId = this.user.employee_ids[0]; const action = await this.orm.call('hr.employee', 'get_formview_action', [employeeId]); this.actionService.doAction(action); } diff --git a/addons/hr/static/src/components/avatar_card/avatar_card_popover_patch.xml b/addons/hr/static/src/components/avatar_card/avatar_card_popover_patch.xml index 10605f9b7d8..916f4a41563 100644 --- a/addons/hr/static/src/components/avatar_card/avatar_card_popover_patch.xml +++ b/addons/hr/static/src/components/avatar_card/avatar_card_popover_patch.xml @@ -2,7 +2,7 @@ - + diff --git a/addons/hr/static/tests/web/m2x_avatar_user_tests.js b/addons/hr/static/tests/web/m2x_avatar_user_tests.js index b0930433126..c56899089bd 100644 --- a/addons/hr/static/tests/web/m2x_avatar_user_tests.js +++ b/addons/hr/static/tests/web/m2x_avatar_user_tests.js @@ -76,7 +76,7 @@ QUnit.module("M2XAvatarUser", ({ beforeEach }) => { "job_title", "department_id", "employee_parent_id", - "employee_id"]); + "employee_ids"]); assert.step("user read"); } };