-
-
Notifications
You must be signed in to change notification settings - Fork 785
[17.0][OU-ADD] hr_recruitment: Migration to 17.0 #4703
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Copyright 2024- Le Filament (https://le-filament.com) | ||
| # 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", "17.0.1.1/noupdate_changes.xml") | ||
| openupgrade.delete_record_translations( | ||
| env.cr, "hr_recruitment", ["applicant_hired_template"] | ||
| ) | ||
| openupgrade.delete_records_safely_by_xml_id( | ||
| env, | ||
| [ | ||
| "hr_recruitment.mail_message_interviewer_rule", | ||
| "hr_recruitment.mail_alias_jobs", | ||
| ], | ||
| ) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # Copyright 2025 Le Filament (https://le-filament.com) | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
| from openupgradelib import openupgrade | ||
|
|
||
|
|
||
| def _fill_sequence_hr_applicant_refuse_reason(cr): | ||
| openupgrade.logged_query( | ||
| cr, | ||
| """ | ||
| ALTER TABLE hr_applicant_refuse_reason | ||
| ADD COLUMN IF NOT EXISTS sequence INTEGER DEFAULT 10; | ||
| """, | ||
remi-filament marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ) | ||
| openupgrade.logged_query( | ||
| cr, | ||
| """ | ||
| ALTER TABLE hr_applicant_refuse_reason ALTER COLUMN sequence DROP DEFAULT; | ||
| """, | ||
| ) | ||
|
|
||
|
|
||
| @openupgrade.migrate(use_env=False) | ||
| def migrate(cr, version): | ||
| _fill_sequence_hr_applicant_refuse_reason(cr) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| ---Models in module 'hr_recruitment'--- | ||
| ---Fields in module 'hr_recruitment'--- | ||
| hr_recruitment / hr.applicant / activity_user_id (many2one) : not related anymore | ||
| hr_recruitment / hr.applicant / activity_user_id (many2one) : now a function | ||
| # NOTHING TO DO: not stored field | ||
|
|
||
| hr_recruitment / hr.applicant / applicant_properties (properties): NEW hasdefault: compute | ||
| # NOTHING TO DO: new properties field | ||
|
|
||
| hr_recruitment / hr.applicant / application_status (selection): selection_keys is now '['archived', 'hired', 'ongoing', 'refused']' ('['hired', 'ongoing', 'refused']') | ||
| # NOTHING TO DO: extra key added in selection | ||
|
|
||
| hr_recruitment / hr.applicant / email_normalized (char) : NEW isfunction: function, stored | ||
| hr_recruitment / hr.applicant / message_bounce (integer) : NEW hasdefault: default | ||
| hr_recruitment / hr.applicant / partner_mobile_sanitized (char): NEW isfunction: function, stored | ||
| hr_recruitment / hr.applicant / partner_phone_sanitized (char): NEW isfunction: function, stored | ||
| hr_recruitment / hr.applicant / phone_mobile_search (char) : NEW | ||
| hr_recruitment / hr.applicant / phone_sanitized (char) : NEW isfunction: function, stored | ||
|
Comment on lines
+13
to
+18
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. too many functions. shouldn't we try to fill this new columns by query? 🤔
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I looked into these ones and they are calling mixin python functions to sanitize / format email and phone wihch for phone depends on localization for instance, so I think it makes more sense to let Odoo compute these fields with Python functions rather than trying to do the same in SQL to reduce migration time ! |
||
| hr_recruitment / hr.applicant / rating_ids (one2many) : NEW relation: rating.rating | ||
| # NOTHING TO DO: new fields | ||
|
|
||
| hr_recruitment / hr.applicant.refuse.reason / _order : _order is now 'sequence' ('id') | ||
| # NOTHING TO DO: new field sequence used to order | ||
|
|
||
| hr_recruitment / hr.applicant.refuse.reason / sequence (integer) : NEW hasdefault: default | ||
| # DONE: pre-migration: pre-create column with default value | ||
|
|
||
| hr_recruitment / hr.job / applicant_properties_definition (properties_definition): NEW | ||
| # NOTHING TO DO: new properties field | ||
|
|
||
| hr_recruitment / hr.job / hr_responsible_id (many2one) : DEL relation: res.users | ||
| # NOTHING TO DO: responsible field removed without a replacement | ||
|
|
||
| ---XML records in module 'hr_recruitment'--- | ||
| NEW hr.recruitment.stage: hr_recruitment.stage_job0 (noupdate) | ||
| NEW ir.actions.act_window: hr_recruitment.action_hr_applicant_mass_sms | ||
| DEL ir.actions.act_window: hr_recruitment.hr_employee_action_from_department | ||
| NEW ir.actions.server: hr_recruitment.ir_actions_server_refuse_applicant | ||
| NEW ir.config_parameter: hr_recruitment.hr_recruitment_blacklisted_emails (noupdate) | ||
| NEW ir.rule: hr_recruitment.hr_applicant_user_rule (noupdate) | ||
| NEW ir.rule: hr_recruitment.hr_job_user_rule (noupdate) | ||
| NEW ir.rule: hr_recruitment.mail_message_user_rule (noupdate) | ||
| NEW ir.ui.view: hr_recruitment.mail_notification_light_without_background (noupdate) | ||
| DEL ir.ui.view: hr_recruitment.hr_employee_view_search | ||
| # NOTHING TO DO: created by ORM (action_hr_applicant_mass_sms needs SMS installed although not a dependency, see https://github.com/odoo/odoo/issues/191635 | ||
|
|
||
| DEL ir.rule: hr_recruitment.mail_message_interviewer_rule (noupdate) | ||
| DEL mail.alias: hr_recruitment.mail_alias_jobs (noupdate) | ||
| # DONE post-migration: safe delete these | ||
Uh oh!
There was an error while loading. Please reload this page.