-
-
Notifications
You must be signed in to change notification settings - Fork 800
[19.0][MIG] stock, stock_account #5547
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
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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
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
11 changes: 11 additions & 0 deletions
11
openupgrade_scripts/scripts/barcodes_gs1_nomenclature/19.0.1.0/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,11 @@ | ||
| # Copyright 2026 Hunki Enterprises BV | ||
| # 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, "barcodes_gs1_nomenclature", "19.0.1.0/noupdate_changes.xml" | ||
| ) |
13 changes: 13 additions & 0 deletions
13
openupgrade_scripts/scripts/stock/19.0.1.1/end-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,13 @@ | ||
| # Copyright 2026 Hunki Enterprises BV | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
|
||
| from openupgradelib import openupgrade | ||
|
|
||
|
|
||
| @openupgrade.migrate() | ||
| def migrate(env, version): | ||
| env["stock.picking"].search( | ||
| [ | ||
| ("move_line_ids", "not in", ("done", "cancel")), | ||
| ] | ||
| )._check_entire_pack() |
144 changes: 144 additions & 0 deletions
144
openupgrade_scripts/scripts/stock/19.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,144 @@ | ||
| # Copyright 2026 Hunki Enterprises BV | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
|
||
| from openupgradelib import openupgrade | ||
|
|
||
|
|
||
| def stock_move_reference_ids(env): | ||
| """ | ||
| Fill stock.move#reference_ids from obsolete group_id | ||
| """ | ||
| env.cr.execute( | ||
| """ | ||
| INSERT INTO stock_reference_move_rel | ||
| (move_id, reference_id) | ||
| SELECT id, group_id FROM stock_move | ||
| WHERE group_id IS NOT NULL | ||
| """ | ||
| ) | ||
|
|
||
|
|
||
| def stock_move_packaging_uom_id(env): | ||
| """ | ||
| Use stock.move#product_packaging_id to fill stock.move#packaging_uom_id | ||
| """ | ||
| env.cr.execute( | ||
| """ | ||
| UPDATE stock_move | ||
| SET packaging_uom_id=product_uom.uom_id | ||
| FROM | ||
| product_uom | ||
| WHERE product_packaging_id=product_uom.id | ||
| """ | ||
| ) | ||
|
|
||
|
|
||
| def stock_picking_package_history_ids(env): | ||
| """ | ||
| Use stock.package_level#picking_id to fill stock.picking#package_history_ids | ||
| """ | ||
| env.cr.execute( | ||
| """ | ||
| INSERT INTO stock_package_history_stock_picking_rel | ||
| (stock_picking_id, stock_package_history_id) | ||
| SELECT picking_id, id | ||
| FROM stock_package_history | ||
| WHERE picking_id IS NOT NULL | ||
| """ | ||
| ) | ||
|
|
||
|
|
||
| def stock_package_type_package_use(env): | ||
| """ | ||
| Set stock.package.type#package_use to 'reusable' if all previous stock.quant.package | ||
| records using this type had package_use = 'reusable' | ||
| """ | ||
| env.cr.execute( | ||
| """ | ||
| UPDATE stock_package_type | ||
| SET package_use='reusable' | ||
| WHERE id IN ( | ||
| SELECT package_type_id | ||
| FROM stock_package | ||
| GROUP BY package_type_id | ||
| HAVING array_agg(distinct package_use) <@ '{"reusable"}' | ||
| ) | ||
| """ | ||
| ) | ||
|
|
||
|
|
||
| def uom_uom_package_type_id(env): | ||
| """ | ||
| Set uom.uom#package_type_id from previous product.packaging#packaging_type | ||
| """ | ||
| env.cr.execute( | ||
| """ | ||
| UPDATE uom_uom | ||
| SET package_type_id=product_uom.package_type_id | ||
| FROM product_uom | ||
| WHERE product_uom.uom_id=uom_uom.id | ||
| AND product_uom.package_type_id IS NOT NULL | ||
| """ | ||
| ) | ||
|
|
||
|
|
||
| def stock_packaging_type_route_ids(env): | ||
| """ | ||
| Set stock.packaging.type#route_ids from previous product.packaging#route_ids | ||
| """ | ||
| env.cr.execute( | ||
| """ | ||
| INSERT INTO stock_package_type_stock_route_rel | ||
| (stock_package_type_id, stock_route_id) | ||
| SELECT DISTINCT | ||
| product_uom.package_type_id, stock_route_packaging.route_id | ||
| FROM | ||
| stock_route_packaging | ||
| JOIN product_uom | ||
| ON stock_route_packaging.packaging_id=product_uom.id | ||
| """ | ||
| ) | ||
|
|
||
|
|
||
| def stock_package_history_package_name(env): | ||
| """ | ||
| Set stock.package.history#package_name from package_id#name | ||
| """ | ||
| env.cr.execute( | ||
| """ | ||
| UPDATE stock_package_history | ||
| SET package_name=stock_package.name | ||
| FROM stock_package | ||
| WHERE | ||
| stock_package_history.package_id=stock_package.id | ||
| AND package_name IS NULL | ||
| """ | ||
| ) | ||
|
|
||
|
|
||
| _deleted_xmlids = [ | ||
| "stock.stock_location_locations_virtual", | ||
| "stock.stock_location_locations_partner", | ||
| "stock.stock_location_locations", | ||
| ] | ||
|
|
||
|
|
||
| @openupgrade.migrate() | ||
| def migrate(env, version): | ||
| openupgrade.load_data(env, "stock", "19.0.1.1/noupdate_changes.xml") | ||
| openupgrade.delete_record_translations( | ||
| env.cr, | ||
| "stock", | ||
| [ | ||
| "mail_template_data_delivery_confirmation", | ||
| ], | ||
| ["body_html"], | ||
| ) | ||
| stock_move_reference_ids(env) | ||
| stock_move_packaging_uom_id(env) | ||
| stock_picking_package_history_ids(env) | ||
| stock_package_type_package_use(env) | ||
| uom_uom_package_type_id(env) | ||
| stock_packaging_type_route_ids(env) | ||
| stock_package_history_package_name(env) | ||
| openupgrade.delete_records_safely_by_xml_id(env, _deleted_xmlids) |
42 changes: 42 additions & 0 deletions
42
openupgrade_scripts/scripts/stock/19.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,42 @@ | ||
| # Copyright 2026 Hunki Enterprises BV | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
|
||
| from openupgradelib import openupgrade | ||
|
|
||
| _renamed_models = [ | ||
| ("procurement.group", "stock.reference"), | ||
| ("stock.package_level", "stock.package.history"), | ||
| ("stock.quant.package", "stock.package"), | ||
| ] | ||
|
|
||
| _renamed_tables = [ | ||
| ("procurement_group", "stock_reference"), | ||
| ("stock_package_level", "stock_package_history"), | ||
| ("stock_quant_package", "stock_package"), | ||
| ] | ||
|
|
||
| _renamed_fields = [ | ||
| ("stock.reference", "stock_reference", "stock_move_ids", "move_ids"), | ||
| ("stock.move.line", "stock_move_line", "package_level_id", "package_history_id"), | ||
| ("stock.picking", "stock_picking", "package_level_ids", "package_history_ids"), | ||
| ("stock.route", "stock_route", "packaging_selectable", "package_type_selectable"), | ||
| ] | ||
|
|
||
| _renamed_xmlids = [ | ||
| ("stock.seq_quant_package", "stock.seq_package"), | ||
| ] | ||
|
|
||
| _deleted_xmlids = [ | ||
| "stock.stock_quant_package_comp_rule", | ||
| "stock.sequence_proc_group", | ||
| "stock.constraint_stock_warehouse_orderpoint_qty_multiple_check", | ||
| ] | ||
|
|
||
|
|
||
| @openupgrade.migrate() | ||
| def migrate(env, version): | ||
| openupgrade.rename_models(env.cr, _renamed_models) | ||
| openupgrade.rename_tables(env.cr, _renamed_tables) | ||
| openupgrade.rename_fields(env, _renamed_fields) | ||
| openupgrade.rename_xmlids(env.cr, _renamed_xmlids) | ||
| openupgrade.delete_records_safely_by_xml_id(env, _deleted_xmlids) | ||
Oops, something went wrong.
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.