Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docsource/modules180-190.rst
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ Module coverage 18.0 -> 19.0
+---------------------------------------------------+----------------------+-------------------------------------------------+
| hr_recruitment |Done | |
+---------------------------------------------------+----------------------+-------------------------------------------------+
| hr_recruitment_skills | | |
| hr_recruitment_skills |Done | |
+---------------------------------------------------+----------------------+-------------------------------------------------+
| hr_recruitment_sms |Nothing to do | |
+---------------------------------------------------+----------------------+-------------------------------------------------+
Expand Down
Original file line number Diff line number Diff line change
@@ -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


@openupgrade.migrate()
def migrate(env, version):
openupgrade.load_data(
env,
"hr_recruitment_skills",
"19.0.1.0/noupdate_changes.xml",
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Copyright 2026 Hunki Enterprises BV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from openupgradelib import openupgrade, openupgrade_tools

copy_columns = {
"hr_candidate_skill": [
("candidate_id", None, None),
("create_date", "valid_from", "date"),
],
}

renamed_fields = [
("hr.applicant.skill", "hr_applicant_skill", "candidate_id", "applicant_id")
]

renamed_models = [
("hr.candidate.skill", "hr.applicant.skill"),
]

renamed_tables = [
("hr_candidate_skill", "hr_applicant_skill"),
]


def hr_applicant_skill(env):
"""
Set hr.applicant.skill#applicant_id (renamed candidate_id) from hr_applicant
"""
openupgrade.lift_constraints(env.cr, "hr_applicant_skill", "applicant_id")
openupgrade.logged_query(
env.cr,
"""
UPDATE hr_applicant_skill
SET applicant_id=hr_applicant.id
FROM hr_applicant
WHERE hr_applicant.candidate_id=hr_applicant_skill.applicant_id
""",
)


def hr_applicant_skill_ids(env):
"""
Pre-create and fill hr.applicant#skill_ids
"""
openupgrade.logged_query(
env.cr,
"""
CREATE TABLE hr_applicant_hr_skill_rel (
hr_applicant_id INTEGER NOT NULL,
hr_skill_id INTEGER NOT NULL,
PRIMARY KEY(hr_applicant_id, hr_skill_id)
);
COMMENT ON TABLE hr_applicant_hr_skill_rel IS
'RELATION BETWEEN hr_applicant AND hr_skill';
CREATE INDEX ON hr_applicant_hr_skill_rel
(hr_skill_id, hr_applicant_id);
""",
)
openupgrade.logged_query(
env.cr,
"""
INSERT INTO hr_applicant_hr_skill_rel (hr_applicant_id, hr_skill_id)
SELECT applicant_id, skill_id FROM hr_applicant_skill
""",
)


@openupgrade.migrate()
def migrate(env, version):
openupgrade.copy_columns(env.cr, copy_columns)
openupgrade.rename_models(env.cr, renamed_models)
if openupgrade_tools.table_exists(env.cr, "hr_applicant_skill"):
# if the database has been migrated from v17, this table can exist already
renamed_tables[0:0] = [("hr_applicant_skill", None)]
openupgrade.rename_tables(env.cr, renamed_tables)
openupgrade.rename_fields(env, renamed_fields)
hr_applicant_skill(env)
hr_applicant_skill_ids(env)
Comment on lines +71 to +79

@MiquelRForgeFlow MiquelRForgeFlow Jul 28, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In v17, it already existed hr_applicant_skill. I mean, the v19 is like v17. See a169af6. My point is: I think that the code should be adapted in a way that people coming from v17 using OU don't get problems, or have a more performance-wise flow, if they have not deleted yet old table.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, I'm checking for this table existing in 820aed2 now (will squash when approved). But I don't see how we can differentiate in a straightforward way between a database that is directly migrating from v17, and one that has been migrated to v18, used for a while, then migrated to v19. Not really worth the trouble I think.

Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---Models in module 'hr_recruitment_skills'---
obsolete model hr.candidate.skill (renamed to hr.applicant.skill)
new model hr.applicant.skill (renamed from hr.candidate.skill)
# DONE: renamed in pre-migration

---Fields in module 'hr_recruitment_skills'---
hr_recruitment_skills / hr.applicant / applicant_skill_ids (one2many): NEW relation: hr.applicant.skill
# DONE: inverse of hr.applicant.skill#applicant_id

hr_recruitment_skills / hr.applicant / current_applicant_skill_ids (one2many): NEW relation: hr.applicant.skill, hasdefault: compute, stored: False
# NOTHING TO DO: not stored

hr_recruitment_skills / hr.applicant / skill_ids (many2many) : is now stored
hr_recruitment_skills / hr.applicant / skill_ids (many2many) : not related anymore
hr_recruitment_skills / hr.applicant / skill_ids (many2many) : now a function
hr_recruitment_skills / hr.applicant / skill_ids (many2many) : table is now 'hr_applicant_hr_skill_rel' ('False')
# DONE: created and filled table in pre-migration

hr_recruitment_skills / hr.applicant.skill / applicant_id (many2one) : NEW relation: hr.applicant, required
# DONE: renamed and adjusted in pre-migration

hr_recruitment_skills / hr.applicant.skill / display_warning_message (boolean): NEW
# NOTHING TO DO: UI field, probably shouldn't be stored in the first palce

hr_recruitment_skills / hr.applicant.skill / valid_from (date) : NEW hasdefault: default
# DONE: set to create_date as v18 doesn't have a concept of apllicant skill validity

hr_recruitment_skills / hr.applicant.skill / valid_to (date) : NEW
# NOTHING TO DO

hr_recruitment_skills / hr.candidate / candidate_skill_ids (one2many): DEL relation: hr.candidate.skill
hr_recruitment_skills / hr.candidate / skill_ids (many2many) : DEL relation: hr.skill
hr_recruitment_skills / hr.candidate.skill / _order : _order is now 'skill_type_id, skill_level_id desc' ('skill_level_id')
hr_recruitment_skills / hr.candidate.skill / candidate_id (many2one) : DEL relation: hr.candidate, required
# NOTHING TO DO: obsolete models

hr_recruitment_skills / hr.job / skill_ids (many2many) : module is now 'hr_skills' ('hr_recruitment_skills')
# NOTHING TO DO: handled in hr_skills

---XML records in module 'hr_recruitment_skills'---
NEW ir.actions.act_window: hr_recruitment_skills.action_find_matching_job
NEW ir.model.access: hr_recruitment_skills.access_hr_applicant_skill_interviewer
NEW ir.model.access: hr_recruitment_skills.access_hr_job_skill_recruitment_user
DEL ir.model.access: hr_recruitment_skills.access_hr_candidate_skill_interviewer
DEL ir.model.constraint: hr_recruitment_skills.constraint_hr_candidate_skill__unique_skill
NEW ir.ui.view: hr_recruitment_skills.crm_case_tree_view_inherit_hr_recruitment_skills
NEW ir.ui.view: hr_recruitment_skills.crm_case_tree_view_job
NEW ir.ui.view: hr_recruitment_skills.hr_job_list_inherit_hr_recruitment_skills
NEW ir.ui.view: hr_recruitment_skills.view_hr_job_form
DEL ir.ui.view: hr_recruitment_skills.hr_candidate_view_form
DEL ir.ui.view: hr_recruitment_skills.hr_candidate_view_search
DEL ir.ui.view: hr_recruitment_skills.hr_candidate_view_tree
DEL ir.ui.view: hr_recruitment_skills.hr_job_form_inherit_hr_recruitment_skills
# NOTHING TO DO
Loading