From 074a84387a37cbd000516860a2006fb3d10b6c2f Mon Sep 17 00:00:00 2001 From: hieu Date: Mon, 20 Jun 2022 16:23:03 +0700 Subject: [PATCH] [MIG]purchase_requisition_stock: add mig script v15 --- docsource/modules140-150.rst | 2 +- .../15.0.1.2/post-migration.py | 19 +++++++++++++++++++ .../15.0.1.2/upgrade_analysis_work.txt | 6 ++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 openupgrade_scripts/scripts/purchase_requisition_stock/15.0.1.2/post-migration.py create mode 100644 openupgrade_scripts/scripts/purchase_requisition_stock/15.0.1.2/upgrade_analysis_work.txt diff --git a/docsource/modules140-150.rst b/docsource/modules140-150.rst index 182f4011d75d..a47303e7284a 100644 --- a/docsource/modules140-150.rst +++ b/docsource/modules140-150.rst @@ -588,7 +588,7 @@ Module coverage 14.0 -> 15.0 +-------------------------------------------------+----------------------+-------------------------------------------------+ | purchase_requisition | | | +-------------------------------------------------+----------------------+-------------------------------------------------+ -| purchase_requisition_stock | | | +| purchase_requisition_stock |Done | | +-------------------------------------------------+----------------------+-------------------------------------------------+ | |new| purchase_requisition_stock_dropshipping | | | +-------------------------------------------------+----------------------+-------------------------------------------------+ diff --git a/openupgrade_scripts/scripts/purchase_requisition_stock/15.0.1.2/post-migration.py b/openupgrade_scripts/scripts/purchase_requisition_stock/15.0.1.2/post-migration.py new file mode 100644 index 000000000000..c0152c7d5518 --- /dev/null +++ b/openupgrade_scripts/scripts/purchase_requisition_stock/15.0.1.2/post-migration.py @@ -0,0 +1,19 @@ +from openupgradelib import openupgrade + + +@openupgrade.migrate() +def migrate(env, version): + openupgrade.logged_query( + env.cr, + """ + WITH subquery as ( + SELECT op.name as origin, p.id as pid + FROM stock_warehouse_orderpoint AS op + LEFT JOIN procurement_group AS p ON op.group_id = p.id + ) + UPDATE purchase_requisition as requisition + SET procurement_group_id = subquery.pid + FROM subquery + WHERE requisition.origin = subquery.origin; + """, + ) diff --git a/openupgrade_scripts/scripts/purchase_requisition_stock/15.0.1.2/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/purchase_requisition_stock/15.0.1.2/upgrade_analysis_work.txt new file mode 100644 index 000000000000..67ea157254f4 --- /dev/null +++ b/openupgrade_scripts/scripts/purchase_requisition_stock/15.0.1.2/upgrade_analysis_work.txt @@ -0,0 +1,6 @@ +---Models in module 'purchase_requisition_stock'--- +---Fields in module 'purchase_requisition_stock'--- +purchase_requisition_stock / purchase.requisition / procurement_group_id (many2one): NEW relation: procurement.group +# DONE: post-migration: fill data from stock.warehouse.orderpoint + +---XML records in module 'purchase_requisition_stock'---