From 7c5a2c601db21cc5bb0de9303cb5bdf8943f6b8e Mon Sep 17 00:00:00 2001 From: "Gaetan Vanden Bergh (gavb)" Date: Fri, 12 Apr 2024 07:31:38 +0200 Subject: [PATCH] [FIX] hr_skills: Add skill from "My Profile" Steps: - Login as "Mitchel Admin" - Install hr_skills_survey - Delete all employee except "Mitchel Admin" - Open "My profile" - Open "Resume" - Add a skill Actual result: - Error due to missing employee - default_employee_id is using the current record id so a user id - default_employee_id is not the correct ID - Can lead to record not existing error or access error Expected result: - No error - default_employee_id is the correct employee of the user - Default employee in dialog is "Mitchel Admin" opw-3852542 closes odoo/odoo#161636 Signed-off-by: Sofie Gvaladze (sgv) --- .../static/src/fields/skills_one2many/skills_one2many.js | 2 +- addons/hr_skills/views/hr_views.xml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/hr_skills/static/src/fields/skills_one2many/skills_one2many.js b/addons/hr_skills/static/src/fields/skills_one2many/skills_one2many.js index 8ec9b5f6225..910af416153 100644 --- a/addons/hr_skills/static/src/fields/skills_one2many/skills_one2many.js +++ b/addons/hr_skills/static/src/fields/skills_one2many/skills_one2many.js @@ -95,7 +95,7 @@ export class SkillsX2ManyField extends X2ManyField { } async onAdd({ context, editable } = {}) { - const employeeId = this.props.record.resId; + const employeeId = this.props.record.resModel === "res.users" ? this.props.record.data.employee_id[0] : this.props.record.resId; return super.onAdd({ editable, context: { diff --git a/addons/hr_skills/views/hr_views.xml b/addons/hr_skills/views/hr_views.xml index 00016c8fa68..91aa0a2d269 100644 --- a/addons/hr_skills/views/hr_views.xml +++ b/addons/hr_skills/views/hr_views.xml @@ -147,6 +147,7 @@
+