-
-
Notifications
You must be signed in to change notification settings - Fork 785
[17.0][OU-ADD] stock_account: Migration to 17.0 #4633
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
Closed
Closed
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
19 changes: 19 additions & 0 deletions
19
openupgrade_scripts/scripts/stock_account/17.0.1.1/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,19 @@ | ||
| # Copyright 2024 Viindoo Technology Joint Stock Company (Viindoo) | ||
| # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
|
||
| from openupgradelib import openupgrade | ||
|
|
||
|
|
||
| def _stock_move_convert_analytic_account_line_id_m2o_to_m2m(env): | ||
| openupgrade.m2o_to_x2m( | ||
| env.cr, | ||
| env["stock.move"], | ||
| "stock_move", | ||
| "analytic_account_line_ids", | ||
| "analytic_account_line_id", | ||
| ) | ||
|
|
||
|
|
||
| @openupgrade.migrate() | ||
| def migrate(env, version): | ||
| _stock_move_convert_analytic_account_line_id_m2o_to_m2m(env) |
37 changes: 37 additions & 0 deletions
37
openupgrade_scripts/scripts/stock_account/17.0.1.1/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,37 @@ | ||
| # Copyright 2023 Trần Trường Sơn | ||
| # Copyright 2023 Rémy Taymans | ||
| # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
|
||
| from openupgradelib import openupgrade | ||
|
|
||
| _new_fields = [ | ||
| ( | ||
| "categ_id", # Field name | ||
| "stock.valuation.layer", # Model name | ||
| "stock_valuation_layer", # Table name | ||
| "many2one", # Odoo Field type (in lower case) | ||
| False, # [Optional] SQL type (if custom fields) | ||
| "stock_account", # Module name | ||
| False, # [Optional] Default value | ||
| ) | ||
| ] | ||
|
|
||
|
|
||
| def _fill_stock_valuation_layer_categ_id(env): | ||
| """Field `categ_id` on stock.valuation.layer is now a stored field.""" | ||
| openupgrade.logged_query( | ||
| env.cr, | ||
| """ | ||
| UPDATE stock_valuation_layer | ||
| SET categ_id = pt.categ_id | ||
| FROM product_product p | ||
| JOIN product_template pt ON p.product_tmpl_id = pt.id | ||
| WHERE stock_valuation_layer.product_id = p.id; | ||
| """, | ||
| ) | ||
|
|
||
|
|
||
| @openupgrade.migrate() | ||
| def migrate(env, version): | ||
| openupgrade.add_fields(env, _new_fields) | ||
| _fill_stock_valuation_layer_categ_id(env) |
31 changes: 31 additions & 0 deletions
31
openupgrade_scripts/scripts/stock_account/17.0.1.1/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,31 @@ | ||
| ---Models in module 'stock_account'--- | ||
| ---Fields in module 'stock_account'--- | ||
| stock_account / account.move.line / cogs_origin_id (many2one) : NEW relation: account.move.line | ||
| # NOTHING TO DO: new feature | ||
|
|
||
| stock_account / stock.move / analytic_account_line_id (many2one): DEL relation: account.analytic.line | ||
| stock_account / stock.move / analytic_account_line_ids (many2many): NEW relation: account.analytic.line | ||
| # DONE post-migraton: m2o to m2m | ||
|
|
||
| stock_account / stock.valuation.layer / categ_id (many2one) : is now stored | ||
| # DONE: pre-migration: Add new column & set value for it | ||
|
|
||
| ---XML records in module 'stock_account'--- | ||
| NEW ir.actions.act_window: stock_account.inventory_aging_action | ||
| NEW ir.filters: stock_account.filter_invoice_inventory_valuation | ||
| # NOTHING TO DO: new feature | ||
|
|
||
| DEL ir.property: stock_account.property_stock_account_input_categ_id (noupdate) | ||
| DEL ir.property: stock_account.property_stock_account_output_categ_id (noupdate) | ||
| # NOTHING TO DO: New noupdate="1" records | ||
|
|
||
| NEW ir.ui.menu: stock_account.menu_inventory_aging | ||
| NEW ir.ui.view: stock_account.stock_valuation_layer_graph | ||
| NEW ir.ui.view: stock_account.stock_valuation_layer_valuation_at_date_tree_inherited | ||
| # NOTHING TO DO: new feature | ||
|
|
||
| DEL ir.ui.view: stock_account.stock_account_report_product_product_replenishment | ||
| # NOTHING TO DO | ||
|
|
||
| NEW res.groups: stock_account.group_stock_accounting_automatic (noupdate) | ||
| # NOTHING TO DO: New noupdate="1" records | ||
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.