forked from OCA/product-attribute
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] product_packaging_level_salable: Add migration scripts
- Loading branch information
duongtq
committed
Sep 19, 2023
1 parent
7347deb
commit f4a45fb
Showing
1 changed file
with
18 additions
and
0 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
product_packaging_level_salable/migrations/16.0.1.0.0/post-migrate.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |