diff --git a/docsource/modules140-150.rst b/docsource/modules140-150.rst index 8df6ab2355eb..efcd7ce84c4f 100644 --- a/docsource/modules140-150.rst +++ b/docsource/modules140-150.rst @@ -124,7 +124,7 @@ Module coverage 14.0 -> 15.0 +-------------------------------------------------+----------------------+-------------------------------------------------+ | crm_sms | Nothing to do | | +-------------------------------------------------+----------------------+-------------------------------------------------+ -| delivery | | | +| delivery | Done | | +-------------------------------------------------+----------------------+-------------------------------------------------+ | |new| delivery_mondialrelay | | | +-------------------------------------------------+----------------------+-------------------------------------------------+ diff --git a/openupgrade_scripts/scripts/delivery/15.0.1.0/post-migration.py b/openupgrade_scripts/scripts/delivery/15.0.1.0/post-migration.py new file mode 100644 index 000000000000..d155245659eb --- /dev/null +++ b/openupgrade_scripts/scripts/delivery/15.0.1.0/post-migration.py @@ -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) diff --git a/openupgrade_scripts/scripts/delivery/15.0.1.0/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/delivery/15.0.1.0/upgrade_analysis_work.txt new file mode 100644 index 000000000000..0c04847e6360 --- /dev/null +++ b/openupgrade_scripts/scripts/delivery/15.0.1.0/upgrade_analysis_work.txt @@ -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