diff --git a/docsource/modules160-170.rst b/docsource/modules160-170.rst index d8e776c84fcb..942d088aa1d1 100644 --- a/docsource/modules160-170.rst +++ b/docsource/modules160-170.rst @@ -588,7 +588,7 @@ Module coverage 16.0 -> 17.0 +---------------------------------------------------+----------------------+-------------------------------------------------+ | |del| note | |Renamed to project_todo. | +---------------------------------------------------+----------------------+-------------------------------------------------+ -| onboarding | | | +| onboarding | Done | | +---------------------------------------------------+----------------------+-------------------------------------------------+ | partner_autocomplete | | | +---------------------------------------------------+----------------------+-------------------------------------------------+ diff --git a/openupgrade_scripts/scripts/onboarding/17.0.1.2/post-migration.py b/openupgrade_scripts/scripts/onboarding/17.0.1.2/post-migration.py new file mode 100644 index 000000000000..c13357bad991 --- /dev/null +++ b/openupgrade_scripts/scripts/onboarding/17.0.1.2/post-migration.py @@ -0,0 +1,33 @@ +# Copyright 2024 Viindoo Technology Joint Stock Company (Viindoo) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from openupgradelib import openupgrade + + +def _onboarding_step_convert_field_m2o_to_m2m(env): + # Convert m2o to m2m in 'onboarding.onboarding.step' + openupgrade.m2o_to_x2m( + env.cr, + env["onboarding.onboarding.step"], + "onboarding_onboarding_step", + "onboarding_ids", + "onboarding_id", + ) + + +def _onboarding_progress_step_convert_field_m2o_to_m2m(env): + """ + Convert m2o to m2m in 'onboarding.progress.step' + """ + openupgrade.m2o_to_x2m( + env.cr, + env["onboarding.progress.step"], + "onboarding_progress_step", + "progress_ids", + "progress_id", + ) + + +@openupgrade.migrate() +def migrate(env, version): + _onboarding_step_convert_field_m2o_to_m2m(env) + _onboarding_progress_step_convert_field_m2o_to_m2m(env) diff --git a/openupgrade_scripts/scripts/onboarding/17.0.1.2/pre-migration.py b/openupgrade_scripts/scripts/onboarding/17.0.1.2/pre-migration.py new file mode 100644 index 000000000000..b2af52db04aa --- /dev/null +++ b/openupgrade_scripts/scripts/onboarding/17.0.1.2/pre-migration.py @@ -0,0 +1,27 @@ +# Copyright 2024 Viindoo Technology Joint Stock Company (Viindoo) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from openupgradelib import openupgrade + + +def _onboarding_step_update_is_per_company(env): + openupgrade.logged_query( + env.cr, + """ + ALTER TABLE onboarding_onboarding_step + ADD COLUMN IF NOT EXISTS is_per_company BOOLEAN; + """, + ) + openupgrade.logged_query( + env.cr, + """ + UPDATE onboarding_onboarding_step t1 + SET is_per_company = true + FROM onboarding_onboarding t2 + WHERE t1.onboarding_id = t2.id AND t2.is_per_company = true + """, + ) + + +@openupgrade.migrate() +def migrate(env, version): + _onboarding_step_update_is_per_company(env) diff --git a/openupgrade_scripts/scripts/onboarding/17.0.1.2/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/onboarding/17.0.1.2/upgrade_analysis_work.txt new file mode 100644 index 000000000000..917b2025ca42 --- /dev/null +++ b/openupgrade_scripts/scripts/onboarding/17.0.1.2/upgrade_analysis_work.txt @@ -0,0 +1,41 @@ +---Models in module 'onboarding'--- +---Fields in module 'onboarding'--- +onboarding / onboarding.onboarding / is_per_company (boolean) : not stored anymore +onboarding / onboarding.onboarding / is_per_company (boolean) : now a function +onboarding / onboarding.onboarding.step / is_per_company (boolean) : NEW hasdefault: default +# DONE pre-migration: update is_per_company for each steps + +onboarding / onboarding.onboarding / panel_background_color (selection): DEL selection_keys: ['blue', 'none', 'orange', 'violet'] +onboarding / onboarding.onboarding / panel_background_image (binary): DEL attachment: True +# NOTHING TO DO + +onboarding / onboarding.onboarding / step_ids (one2many) : table is now 'onboarding_onboarding_onboarding_onboarding_step_rel' ('False') +onboarding / onboarding.onboarding / step_ids (one2many) : type is now 'many2many' ('one2many') +onboarding / onboarding.onboarding / text_completed (char) : NEW hasdefault: default +# NOTHING TO DO: handle by ORM + +onboarding / onboarding.onboarding.step / onboarding_id (many2one) : DEL relation: onboarding.onboarding, required +onboarding / onboarding.onboarding.step / onboarding_ids (many2many) : NEW relation: onboarding.onboarding +# DONE post-migration: convert from m2o to m2m + +onboarding / onboarding.onboarding.step / step_image (binary) : NEW attachment: True +onboarding / onboarding.onboarding.step / step_image_alt (char) : NEW hasdefault: default +onboarding / onboarding.onboarding.step / step_image_filename (char) : NEW +# NOTHING TO DO + +onboarding / onboarding.progress / progress_step_ids (one2many) : table is now 'onboarding_progress_onboarding_progress_step_rel' ('False') +onboarding / onboarding.progress / progress_step_ids (one2many) : type is now 'many2many' ('one2many') +# NOTHING TO DO: handle by ORM + +onboarding / onboarding.progress.step / company_id (many2one) : NEW relation: res.company +# NOTHING TO DO + +onboarding / onboarding.progress.step / progress_id (many2one) : DEL relation: onboarding.progress, required +onboarding / onboarding.progress.step / progress_ids (many2many) : NEW relation: onboarding.progress +# DONE pre-migration: convert from m2o to m2m + +---XML records in module 'onboarding'--- +DEL ir.model.constraint: onboarding.constraint_onboarding_progress_onboarding_company_uniq +DEL ir.model.constraint: onboarding.constraint_onboarding_progress_step_progress_step_uniq +NEW ir.ui.view: onboarding.onboarding_step +# NOTHING TO DO