-
-
Notifications
You must be signed in to change notification settings - Fork 695
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by pedrobaeza
- Loading branch information
Showing
4 changed files
with
102 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
33 changes: 33 additions & 0 deletions
33
openupgrade_scripts/scripts/onboarding/17.0.1.2/post-migration.py
This file contains 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,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) |
27 changes: 27 additions & 0 deletions
27
openupgrade_scripts/scripts/onboarding/17.0.1.2/pre-migration.py
This file contains 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,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) |
41 changes: 41 additions & 0 deletions
41
openupgrade_scripts/scripts/onboarding/17.0.1.2/upgrade_analysis_work.txt
This file contains 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,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 |