From f4a45fb1e94afec824081750f5dfdb6fdb7bd9d5 Mon Sep 17 00:00:00 2001 From: duongtq Date: Tue, 1 Aug 2023 16:41:34 +0700 Subject: [PATCH] [IMP] product_packaging_level_salable: Add migration scripts --- .../migrations/16.0.1.0.0/post-migrate.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 product_packaging_level_salable/migrations/16.0.1.0.0/post-migrate.py diff --git a/product_packaging_level_salable/migrations/16.0.1.0.0/post-migrate.py b/product_packaging_level_salable/migrations/16.0.1.0.0/post-migrate.py new file mode 100644 index 00000000000..2e5b585df39 --- /dev/null +++ b/product_packaging_level_salable/migrations/16.0.1.0.0/post-migrate.py @@ -0,0 +1,18 @@ +# Copyright 2023 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from openupgradelib import openupgrade + + +def _fill_in_columns(env): + if openupgrade.column_exists(env.cr, "product_packaging", "can_be_sold"): + query = """ + UPDATE product_packaging + SET sales = can_be_sold + """ + openupgrade.logged_query(env.cr, query) + + +@openupgrade.migrate() +def migrate(env, version): + _fill_in_columns(env)