-
-
Notifications
You must be signed in to change notification settings - Fork 821
[19.0][MIG] hr_recruitment_skills #5847
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
openupgrade_scripts/scripts/hr_recruitment_skills/19.0.1.0/post-migration.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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", | ||
| ) |
79 changes: 79 additions & 0 deletions
79
openupgrade_scripts/scripts/hr_recruitment_skills/19.0.1.0/pre-migration.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) | ||
54 changes: 54 additions & 0 deletions
54
openupgrade_scripts/scripts/hr_recruitment_skills/19.0.1.0/upgrade_analysis_work.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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.There was a problem hiding this comment.
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.