-
-
Notifications
You must be signed in to change notification settings - Fork 697
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3752 from Tecnativa/v15_mig_delivery_oca
[15.0][OU-ADD] delivery: Migration scripts
- Loading branch information
Showing
3 changed files
with
64 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
40 changes: 40 additions & 0 deletions
40
openupgrade_scripts/scripts/delivery/15.0.1.0/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,40 @@ | ||
from openupgradelib import openupgrade | ||
|
||
|
||
def _move_data_from_product_packaging_to_stock_package_type(env): | ||
openupgrade.logged_query( | ||
env.cr, | ||
"""ALTER TABLE stock_package_type | ||
ADD COLUMN IF NOT EXISTS old_product_packaging_id INTEGER""", | ||
) | ||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
INSERT INTO stock_package_type(old_product_packaging_id, | ||
name, sequence, height, width, | ||
shipper_package_code, package_carrier_type, | ||
packaging_length, max_weight, barcode, company_id, | ||
create_uid, create_date, write_uid, write_date) | ||
SELECT id, | ||
name, sequence, height, width, | ||
shipper_package_code, package_carrier_type, | ||
packaging_length, max_weight, barcode, company_id, | ||
create_uid, create_date, write_uid, write_date | ||
FROM product_packaging | ||
WHERE product_id IS NULL | ||
""", | ||
) | ||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
UPDATE stock_quant_package sqp | ||
SET package_type_id = spt.id | ||
FROM stock_package_type spt | ||
WHERE spt.old_product_packaging_id = sqp.packaging_id | ||
""", | ||
) | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
_move_data_from_product_packaging_to_stock_package_type(env) |
23 changes: 23 additions & 0 deletions
23
openupgrade_scripts/scripts/delivery/15.0.1.0/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,23 @@ | ||
---Models in module 'delivery'--- | ||
---Fields in module 'delivery'--- | ||
delivery / product.packaging / height (integer) : DEL | ||
delivery / product.packaging / max_weight (float) : DEL | ||
delivery / product.packaging / package_carrier_type (selection): DEL selection_keys: ['none'] | ||
delivery / product.packaging / packaging_length (integer) : DEL | ||
delivery / product.packaging / shipper_package_code (char) : DEL | ||
delivery / product.packaging / width (integer) : DEL | ||
delivery / stock.package.type / package_carrier_type (selection): NEW selection_keys: ['none'], hasdefault | ||
delivery / stock.package.type / shipper_package_code (char) : NEW | ||
# DONE: post-migration: move data from product_packaging table to stock_package_type | ||
|
||
---XML records in module 'delivery'--- | ||
DEL ir.actions.act_window: delivery.action_delivery_packaging_view | ||
DEL ir.ui.menu: delivery.menu_delivery [renamed to stock module] | ||
DEL ir.ui.menu: delivery.menu_delivery_packagings | ||
NEW ir.ui.view: delivery.stock_package_type_form_delivery | ||
NEW ir.ui.view: delivery.stock_package_type_tree_delivery | ||
NEW ir.ui.view: delivery.view_move_line_tree_detailed_delivery | ||
DEL ir.ui.view: delivery.product_packaging_delivery_form | ||
DEL ir.ui.view: delivery.product_packaging_delivery_tree | ||
DEL ir.ui.view: delivery.view_quant_package_packaging_tree | ||
# NOTHING TO DO: noupdate="0" records |