Hi,
Custom development is the cleanest way to make E-Learning and Skills Management talk to each other, because out of the box, they are completely separate apps.
Refer to the following code for updating the skills when an employee completes the course.
Try the code,
from odoo import models, fields, api
class SlideChannel(models.Model):
_inherit = "slide.channel"
# Skill to be linked with this course
linked_skill_id = fields.Many2one("hr.skill", string="Linked Skill")
class SlideChannelPartner(models.Model):
_inherit = "slide.channel.partner"
@api.model
def create(self, vals):
rec = super().create(vals)
rec._update_employee_skill_on_completion()
return rec
def write(self, vals):
res = super().write(vals)
if "completed" in vals and vals["completed"]:
for rec in self:
rec._update_employee_skill_on_completion()
return res
def _update_employee_skill_on_completion(self):
"""If course is completed and has linked skill, update employee's resume."""
for rec in self:
if rec.completed and rec.channel_id.linked_skill_id:
# find employee for the user
employee = self.env["hr.employee"].search(
[("user_id", "=", rec.partner_id.user_ids.id)], limit=1
)
if employee:
skill = rec.channel_id.linked_skill_id
# check if already has skill
emp_skill = self.env["hr.employee.skill"].search([
("employee_id", "=", employee.id),
("skill_id", "=", skill.id)
], limit=1)
if not emp_skill:
# pick default level (lowest level in that skill type)
default_level = self.env["hr.skill.level"].search([], limit=1)
self.env["hr.employee.skill"].create({
"employee_id": employee.id,
"skill_id": skill.id,
"skill_level_id": default_level.id if default_level else False,
})
* Adds a “Linked Skill” field to each eLearning course.
* Hooks into slide.channel.partner (the record that tracks if a user completed a course).
* When a course is marked completed, the system:
- Finds the corresponding employee for the user.
- Gets the skill linked to the course.
- Creates a new hr.employee.skill record if the employee doesn’t already have it.
Hope it helps