From 0f8e1e49de30cc94272b42f28228ce66a88a7c6c Mon Sep 17 00:00:00 2001 From: Alexis Date: Thu, 26 Sep 2024 15:13:04 -0400 Subject: [PATCH] [17.0][OU-ADD] sale: Migration to 17.0 --- .../scripts/sale/17.0.1.2/post-migration.py | 17 ----------------- .../scripts/sale/17.0.1.2/pre-migration.py | 16 ++++------------ 2 files changed, 4 insertions(+), 29 deletions(-) diff --git a/openupgrade_scripts/scripts/sale/17.0.1.2/post-migration.py b/openupgrade_scripts/scripts/sale/17.0.1.2/post-migration.py index 020f529891c4..a75a80ea2ee3 100644 --- a/openupgrade_scripts/scripts/sale/17.0.1.2/post-migration.py +++ b/openupgrade_scripts/scripts/sale/17.0.1.2/post-migration.py @@ -4,23 +4,6 @@ from openupgradelib import openupgrade -def _sale_sale_order_(env): - openupgrade.logged_query( - env.cr, - """ - UPDATE sale_order - SET locked = True - WHERE temp_state = 'done' - """, - ) - openupgrade.logged_query( - env.cr, - """ - "ALTER TABLE sale_order DROP COLUMN temp_state", - """, - ) - - @openupgrade.migrate() def migrate(env, version): openupgrade.load_data(env, "sale", "17.0.1.2/noupdate_changes.xml") diff --git a/openupgrade_scripts/scripts/sale/17.0.1.2/pre-migration.py b/openupgrade_scripts/scripts/sale/17.0.1.2/pre-migration.py index a19927431d69..b4e44fac8b5c 100644 --- a/openupgrade_scripts/scripts/sale/17.0.1.2/pre-migration.py +++ b/openupgrade_scripts/scripts/sale/17.0.1.2/pre-migration.py @@ -13,27 +13,19 @@ def _remove_table_constraints(env): ) -def _sale_sale_order(env): +def _sale_order_populate_locked_field(env): openupgrade.logged_query( env.cr, """ ALTER TABLE sale_order - ADD COLUMN IF NOT EXISTS locked BOOLEAN, - ADD COLUMN IF NOT EXISTS temp_state VARCHAR + ADD COLUMN IF NOT EXISTS locked BOOLEAN """, ) openupgrade.logged_query( env.cr, """ UPDATE sale_order - SET temp_state = state - """, - ) - openupgrade.logged_query( - env.cr, - """ - UPDATE sale_order - SET state = 'sale' + SET locked = True, state = 'sale' WHERE state = 'done' """, ) @@ -42,4 +34,4 @@ def _sale_sale_order(env): @openupgrade.migrate() def migrate(env, version): _remove_table_constraints(env) - _sale_sale_order(env) + _sale_order_populate_locked_field(env)