diff --git a/docsource/modules180-190.rst b/docsource/modules180-190.rst index 00398d4dccc8..a785cbc7161a 100644 --- a/docsource/modules180-190.rst +++ b/docsource/modules180-190.rst @@ -208,7 +208,7 @@ Module coverage 18.0 -> 19.0 +---------------------------------------------------+----------------------+-------------------------------------------------+ | hr_recruitment_survey | |No DB layout changes. | +---------------------------------------------------+----------------------+-------------------------------------------------+ -| hr_skills | | | +| hr_skills |Done | | +---------------------------------------------------+----------------------+-------------------------------------------------+ | |new| hr_skills_event | | | +---------------------------------------------------+----------------------+-------------------------------------------------+ diff --git a/openupgrade_scripts/scripts/hr_skills/19.0.1.0/post-migration.py b/openupgrade_scripts/scripts/hr_skills/19.0.1.0/post-migration.py new file mode 100644 index 000000000000..3191e1b2ec9f --- /dev/null +++ b/openupgrade_scripts/scripts/hr_skills/19.0.1.0/post-migration.py @@ -0,0 +1,60 @@ +# Copyright 2026 Hunki Enterprises BV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from openupgradelib import openupgrade + + +def hr_employee_skill_validity_dates(env): + """ + Set hr.employee.skill#valid_from from hr.employee.skill.log + """ + env.cr.execute( + """ + UPDATE hr_employee_skill hes + SET valid_from = hesl.date + FROM + hr_employee_skill_log hesl + WHERE + hes.employee_id = hesl.employee_id + AND + hes.skill_id = hesl.skill_id + AND + hes.skill_level_id = hesl.skill_level_id + AND + hes.skill_type_id = hesl.skill_type_id + """ + ) + + env.cr.execute( + """ + UPDATE hr_employee_skill + SET valid_from = create_date + WHERE valid_from IS NULL AND create_date IS NOT NULL + """ + ) + + +def hr_job_job_skill_ids(env): + """ + For every job in hr.job#skill_ids, create a default hr.job.skill entry + (this happens only if hr_recruitment_skills has been installed in v18) + """ + HrJobSkill = env["hr.job.skill"] + for job in env["hr.job"].search([("skill_ids", "!=", False)]): + hr_job_skill_vals = [] + for skill in job.skill_ids: + vals = { + "job_id": job.id, + "skill_id": skill.id, + "skill_type_id": skill.skill_type_id.id, + } + vals["skill_level_id"] = HrJobSkill.new(vals).skill_level_id.id + hr_job_skill_vals.append(vals) + env["hr.job.skill"].create(hr_job_skill_vals) + + +@openupgrade.migrate() +def migrate(env, version): + openupgrade.load_data(env, "hr_skills", "19.0.1.0/noupdate_changes.xml") + hr_employee_skill_validity_dates(env) + hr_job_job_skill_ids(env) diff --git a/openupgrade_scripts/scripts/hr_skills/19.0.1.0/pre-migration.py b/openupgrade_scripts/scripts/hr_skills/19.0.1.0/pre-migration.py new file mode 100644 index 000000000000..882527605941 --- /dev/null +++ b/openupgrade_scripts/scripts/hr_skills/19.0.1.0/pre-migration.py @@ -0,0 +1,13 @@ +# Copyright 2026 Hunki Enterprises BV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from openupgradelib import openupgrade + +_added_fields = [ + ("valid_from", "hr.employee.skill", "hr_employee_skill", "date", None, "hr_skills"), +] + + +@openupgrade.migrate() +def migrate(env, version): + openupgrade.add_fields(env, _added_fields) diff --git a/openupgrade_scripts/scripts/hr_skills/19.0.1.0/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/hr_skills/19.0.1.0/upgrade_analysis_work.txt new file mode 100644 index 000000000000..87cd6e268846 --- /dev/null +++ b/openupgrade_scripts/scripts/hr_skills/19.0.1.0/upgrade_analysis_work.txt @@ -0,0 +1,125 @@ +---Models in module 'hr_skills'--- +obsolete model hr.employee.skill.log + +# DONE: used to set hr.employee.skill#{valid_from,valid_to} + +new model hr.employee.certification.report [abstract] +new model hr.employee.skill.history.report [abstract] +new model hr.individual.skill.mixin [abstract] +new model hr.job.skill + +# NOTHING TO DO + +---Fields in module 'hr_skills'--- +hr_recruitment_skills / hr.job / skill_ids (many2many) : now a function +hr_skills / hr.employee / certification_ids (one2many) : NEW relation: hr.employee.skill, hasdefault: compute, stored: False +hr_skills / hr.employee / current_employee_skill_ids (one2many): NEW relation: hr.employee.skill, hasdefault: compute, stored: False +hr_skills / hr.employee.skill / display_warning_message (boolean): NEW + +# NOTHING TO DO + +hr_skills / hr.employee.skill / valid_from (date) : NEW hasdefault: default + +# DONE: precreate this column to avoid default in pre-migration, set from hr.employee.skill.log in post-migration + +hr_skills / hr.employee.skill / valid_to (date) : NEW + +# DONE: set from hr.employee.skill.log in post-migration + +hr_skills / hr.employee.skill.log / date (date) : DEL +hr_skills / hr.employee.skill.log / department_id (many2one) : DEL relation: hr.department +hr_skills / hr.employee.skill.log / employee_id (many2one) : DEL relation: hr.employee, required +hr_skills / hr.employee.skill.log / level_progress (integer) : DEL +hr_skills / hr.employee.skill.log / skill_id (many2one) : DEL relation: hr.skill, required +hr_skills / hr.employee.skill.log / skill_level_id (many2one) : DEL relation: hr.skill.level, required +hr_skills / hr.employee.skill.log / skill_type_id (many2one) : DEL relation: hr.skill.type, required + +# DONE: used to set hr.employee.skill#valid_from + +hr_skills / hr.job / current_job_skill_ids (one2many): NEW relation: hr.job.skill, hasdefault: compute, stored: False +hr_skills / hr.job / job_skill_ids (one2many) : NEW relation: hr.job.skill + +# DONE: create records of hr.job.skill for existing records in hr.job#skill_ids + +hr_skills / hr.job / skill_ids (many2many) : previously in module hr_recruitment_skills + +# NOTHING TO DO + +hr_skills / hr.job.skill / display_warning_message (boolean): NEW +hr_skills / hr.job.skill / job_id (many2one) : NEW relation: hr.job, required +hr_skills / hr.job.skill / skill_id (many2one) : NEW relation: hr.skill, required, hasdefault: compute +hr_skills / hr.job.skill / skill_level_id (many2one) : NEW relation: hr.skill.level, required, hasdefault: compute +hr_skills / hr.job.skill / skill_type_id (many2one) : NEW relation: hr.skill.type, required, hasdefault: default +hr_skills / hr.job.skill / valid_from (date) : NEW hasdefault: default +hr_skills / hr.job.skill / valid_to (date) : NEW + +# DONE: see hr.job#skill_ids + +hr_skills / hr.resume.line / certificate_file (binary) : NEW attachment: True +hr_skills / hr.resume.line / certificate_filename (char) : NEW +hr_skills / hr.resume.line / course_type (selection) : NEW required, selection_keys: ['external'], hasdefault: default +hr_skills / hr.resume.line / department_id (many2one) : previously in module hr_skills_survey +hr_skills / hr.resume.line / display_type (selection) : DEL selection_keys: ['classic'] +hr_skills / hr.resume.line / duration (integer) : NEW +hr_skills / hr.resume.line / external_url (char) : NEW hasdefault: compute +hr_skills / hr.resume.line / resume_line_properties (properties): NEW hasdefault: compute +hr_skills / hr.resume.line.type / is_course (boolean) : NEW hasdefault: default +hr_skills / hr.resume.line.type / resume_line_type_properties_definition (properties_definition): NEW +hr_skills / hr.skill.level / _order : _order is now 'level_progress' ('level_progress desc') +hr_skills / hr.skill.level / technical_is_new_default (boolean): NEW hasdefault: compute, stored: False +hr_skills / hr.skill.type / _order : _order is now 'sequence, name' ('name') +hr_skills / hr.skill.type / is_certification (boolean) : NEW +hr_skills / hr.skill.type / levels_count (integer) : NEW hasdefault: compute +hr_skills / hr.skill.type / sequence (integer) : NEW +hr_skills / res.users / employee_skill_ids (one2many) : module is now 'project_hr_skills' ('hr_skills') +hr_skills_survey / hr.resume.line / department_id (many2one) : not stored anymore + +# NOTHING TO DO + +---XML records in module 'hr_skills'--- +NEW hr.resume.line.type: hr_skills.resume_type_training [renamed from hr_skills_slides module] +DEL hr.resume.line.type: hr_skills.resume_type_social_media +NEW ir.actions.act_window: hr_skills.action_hr_employee_skill_certification +NEW ir.actions.act_window: hr_skills.hr_employee_certification_report_action [renamed from hr_skills_survey module] (deleted domain) +NEW ir.actions.act_window: hr_skills.hr_resume_lines_training_action +DEL ir.actions.act_window: hr_skills.action_hr_employee_skill_log_employee +NEW ir.cron: hr_skills.hr_job_skills_cron_add_certification_activity_to_employees +NEW ir.model.access: hr_skills.access_hr_employee_certification_report_user +NEW ir.model.access: hr_skills.access_hr_employee_skill_history_report +NEW ir.model.access: hr_skills.access_hr_employee_skill_history_report_manager +NEW ir.model.access: hr_skills.access_hr_job_skill +NEW ir.model.access: hr_skills.access_hr_job_skill_employee +DEL ir.model.access: hr_skills.access_hr_employee_skill_log +DEL ir.model.access: hr_skills.access_hr_employee_skill_log_manager +DEL ir.model.constraint: hr_skills.constraint_hr_employee_skill__unique_skill +DEL ir.model.constraint: hr_skills.constraint_hr_employee_skill_log__unique_skill_log +NEW ir.rule: hr_skills.hr_employee_skill_history_report_hr_user (noupdate) +NEW ir.rule: hr_skills.hr_employee_skill_history_report_manager (noupdate) +NEW ir.ui.menu: hr_skills.hr_certification_menu +NEW ir.ui.menu: hr_skills.hr_employee_certification_report_menu +NEW ir.ui.menu: hr_skills.hr_employee_skill_inventory_report_menu +NEW ir.ui.menu: hr_skills.hr_skill_learning_menu +NEW ir.ui.menu: hr_skills.menu_learnings_training_attendances +NEW ir.ui.view: hr_skills.employee_skill_view_inherit_certificate_form +NEW ir.ui.view: hr_skills.hr_employee_certification_report_view_list +NEW ir.ui.view: hr_skills.hr_employee_certification_report_view_pivot +NEW ir.ui.view: hr_skills.hr_employee_certification_report_view_search +NEW ir.ui.view: hr_skills.hr_employee_skill_history_report_view_graph +NEW ir.ui.view: hr_skills.hr_employee_skill_history_report_view_search +NEW ir.ui.view: hr_skills.hr_employee_skill_view_list +NEW ir.ui.view: hr_skills.hr_employee_skill_view_search +NEW ir.ui.view: hr_skills.hr_job_skill_view_form +NEW ir.ui.view: hr_skills.hr_resume_line_calendar_view +NEW ir.ui.view: hr_skills.hr_resume_line_kanban_view +NEW ir.ui.view: hr_skills.hr_resume_line_list_view +NEW ir.ui.view: hr_skills.resume_line_view_form_inherit +NEW ir.ui.view: hr_skills.view_hr_job_form +NEW ir.ui.view: hr_skills.view_resume_lines_filter +DEL ir.ui.view: hr_skills.hr_employee_skill_log_view_graph_department +DEL ir.ui.view: hr_skills.hr_employee_skill_log_view_graph_employee +DEL ir.ui.view: hr_skills.hr_employee_skill_log_view_search +DEL ir.ui.view: hr_skills.hr_employee_skill_log_view_tree +DEL ir.ui.view: hr_skills.res_users_view_form +NEW mail.activity.type: hr_skills.mail_activity_data_upload_certification (noupdate) + +# NOTHING TO DO