From 77aadef24d5f8b1ae3840c5485941e08cc2a55a3 Mon Sep 17 00:00:00 2001 From: Dang Van Loc Date: Wed, 28 Jun 2023 15:14:17 +0700 Subject: [PATCH] [OU-ADD] barcode_gs1_nomenclature update fields type as `packaging_date` to `pack_date` --- docsource/modules150-160.rst | 2 +- .../16.0.1.0/post-migration.py | 8 ++++++++ .../16.0.1.0/pre-migration.py | 17 +++++++++++++++++ .../16.0.1.0/upgrade_analysis_work.txt | 17 +++++++++++++++++ 4 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 openupgrade_scripts/scripts/barcodes_gs1_nomenclature/16.0.1.0/post-migration.py create mode 100644 openupgrade_scripts/scripts/barcodes_gs1_nomenclature/16.0.1.0/pre-migration.py create mode 100644 openupgrade_scripts/scripts/barcodes_gs1_nomenclature/16.0.1.0/upgrade_analysis_work.txt diff --git a/docsource/modules150-160.rst b/docsource/modules150-160.rst index 20d035409bb0..7ecb4b690e84 100644 --- a/docsource/modules150-160.rst +++ b/docsource/modules150-160.rst @@ -64,7 +64,7 @@ Module coverage 15.0 -> 16.0 +-------------------------------------------------+----------------------+-------------------------------------------------+ | barcodes | |No DB layout changes. | +-------------------------------------------------+----------------------+-------------------------------------------------+ -| barcodes_gs1_nomenclature | | | +| barcodes_gs1_nomenclature | Done | | +-------------------------------------------------+----------------------+-------------------------------------------------+ | base | Done (partial) | | +-------------------------------------------------+----------------------+-------------------------------------------------+ diff --git a/openupgrade_scripts/scripts/barcodes_gs1_nomenclature/16.0.1.0/post-migration.py b/openupgrade_scripts/scripts/barcodes_gs1_nomenclature/16.0.1.0/post-migration.py new file mode 100644 index 000000000000..7594d755f8e2 --- /dev/null +++ b/openupgrade_scripts/scripts/barcodes_gs1_nomenclature/16.0.1.0/post-migration.py @@ -0,0 +1,8 @@ +from openupgradelib import openupgrade + + +@openupgrade.migrate() +def migrate(env, version): + openupgrade.load_data( + env.cr, "barcodes_gs1_nomenclature", "16.0.1.0/noupdate_changes.xml" + ) diff --git a/openupgrade_scripts/scripts/barcodes_gs1_nomenclature/16.0.1.0/pre-migration.py b/openupgrade_scripts/scripts/barcodes_gs1_nomenclature/16.0.1.0/pre-migration.py new file mode 100644 index 000000000000..9d059dfdc23a --- /dev/null +++ b/openupgrade_scripts/scripts/barcodes_gs1_nomenclature/16.0.1.0/pre-migration.py @@ -0,0 +1,17 @@ +from openupgradelib import openupgrade + + +def set_type(env): + openupgrade.logged_query( + env.cr, + """ + UPDATE barcode_rule + SET type = 'pack_date' + WHERE type = 'packaging_date' + """, + ) + + +@openupgrade.migrate() +def migrate(env, version): + set_type(env) diff --git a/openupgrade_scripts/scripts/barcodes_gs1_nomenclature/16.0.1.0/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/barcodes_gs1_nomenclature/16.0.1.0/upgrade_analysis_work.txt new file mode 100644 index 000000000000..01a0e90afe91 --- /dev/null +++ b/openupgrade_scripts/scripts/barcodes_gs1_nomenclature/16.0.1.0/upgrade_analysis_work.txt @@ -0,0 +1,17 @@ +---Models in module 'barcodes_gs1_nomenclature'--- +---Fields in module 'barcodes_gs1_nomenclature'--- +barcodes_gs1_nomenclature / barcode.rule / type (False) : selection_keys is now '['alias', 'expiration_date', 'location', 'location_dest', 'lot', 'pack_date', 'package', 'package_type', 'product', 'quantity', 'use_date']' ('['alias', 'expiration_date', 'location', 'location_dest', 'lot', 'package', 'package_type', 'packaging_date', 'product', 'quantity', 'use_date']') + +# DONE: update type value = packaging_date to pack_date + +---XML records in module 'barcodes_gs1_nomenclature'--- +NEW barcode.rule: barcodes_gs1_nomenclature.barcode_rule_gs1_314y (noupdate) +NEW barcode.rule: barcodes_gs1_nomenclature.barcode_rule_gs1_320y (noupdate) +NEW barcode.rule: barcodes_gs1_nomenclature.barcode_rule_gs1_322y (noupdate) +NEW barcode.rule: barcodes_gs1_nomenclature.barcode_rule_gs1_323y (noupdate) +NEW barcode.rule: barcodes_gs1_nomenclature.barcode_rule_gs1_351y (noupdate) +NEW barcode.rule: barcodes_gs1_nomenclature.barcode_rule_gs1_360y (noupdate) +NEW barcode.rule: barcodes_gs1_nomenclature.barcode_rule_gs1_361y (noupdate) +NEW barcode.rule: barcodes_gs1_nomenclature.barcode_rule_gs1_364y (noupdate) + +# NOTHING TO DO