Skip to content

Commit

Permalink
[17.0][OU-ADD] sale: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
acpMicrocom committed Sep 26, 2024
1 parent f631676 commit 0f8e1e4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 29 deletions.
17 changes: 0 additions & 17 deletions openupgrade_scripts/scripts/sale/17.0.1.2/post-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
16 changes: 4 additions & 12 deletions openupgrade_scripts/scripts/sale/17.0.1.2/pre-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
""",
)
Expand All @@ -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)

0 comments on commit 0f8e1e4

Please sign in to comment.