[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) <sgv@odoo.com>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<templates xml:space="preserve">
|
||||
<t t-inherit="mail.AvatarCardPopover" t-inherit-mode="extension">
|
||||
<xpath expr="//div[hasclass('o_avatar_card_buttons')]" position="inside">
|
||||
<button class="btn btn-secondary btn-sm" t-if="user.employee_id" t-on-click.stop="onClickViewEmployee">View profile</button>
|
||||
<button class="btn btn-secondary btn-sm" t-if="user.employee_ids?.length > 0" t-on-click.stop="onClickViewEmployee">View profile</button>
|
||||
</xpath>
|
||||
</t>
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ QUnit.module("M2XAvatarUser", ({ beforeEach }) => {
|
||||
"job_title",
|
||||
"department_id",
|
||||
"employee_parent_id",
|
||||
"employee_id"]);
|
||||
"employee_ids"]);
|
||||
assert.step("user read");
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user