[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) <sgv@odoo.com>
This commit is contained in:
Gaetan Vanden Bergh (gavb)
2024-04-15 14:09:44 +00:00
parent 1648ee1abf
commit 7c5a2c601d
2 changed files with 2 additions and 1 deletions
@@ -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: {
+1
View File
@@ -147,6 +147,7 @@
<xpath expr="//page[@name='public']" position="before">
<page name="skills_resume" string="Resume">
<div class="row">
<field name="employee_id" invisible="1" />
<div class="o_hr_skills_group o_group_resume col-lg-7 d-flex">
<!-- This field uses a custom tree view rendered by the 'resume_one2many' widget.
Adding fields in the tree arch below makes them accessible to the widget