-
-
Notifications
You must be signed in to change notification settings - Fork 785
[17.0][OU-ADD] onboarding: migrate to 17.0 #4465
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
OCA-git-bot
merged 1 commit into
OCA:17.0
from
daiduongnguyen-odoo:v17_ou_add_onboarding
Oct 30, 2024
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
33 changes: 33 additions & 0 deletions
33
openupgrade_scripts/scripts/onboarding/17.0.1.2/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,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", | ||
pedrobaeza marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ) | ||
|
|
||
|
|
||
| @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 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,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 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,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 |
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.