-
-
Notifications
You must be signed in to change notification settings - Fork 805
Expand file tree
/
Copy pathpre-migration.py
More file actions
24 lines (21 loc) · 957 Bytes
/
pre-migration.py
File metadata and controls
24 lines (21 loc) · 957 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Copyright 2025 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from openupgradelib import openupgrade
@openupgrade.migrate()
def migrate(env, version):
openupgrade.rename_fields(
env, [("product.product", "product_product", "ribbon_id", "variant_ribbon_id")]
)
openupgrade.logged_query(
env.cr, "UPDATE product_ribbon SET bg_color='' WHERE bg_color IS NULL"
)
openupgrade.logged_query(
env.cr, "UPDATE product_ribbon SET text_color='' WHERE text_color IS NULL"
)
# If public_description exists, copy its content to description_ecommerce because
# this field has been deprecated in favor of description_ecommerce in 18.0
if openupgrade.column_exists(env.cr, "product_template", "public_description"):
openupgrade.logged_query(
env.cr,
"UPDATE product_template SET description_ecommerce=public_description",
)