Skip to content

Commit

Permalink
[MIG] sale_order_secondary_unit: Add migration script to adapt secod …
Browse files Browse the repository at this point in the history
…uom to variants

TT45597
  • Loading branch information
sergio-teruel committed Oct 31, 2023
1 parent 1e10d30 commit 703ec24
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions sale_order_secondary_unit/migrations/15.0.2.0.0/post-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2023 Tecnativa - Sergio Teruel
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version):
# Set default sale secondary uom from template to variants
sql = """
UPDATE product_product pp
SET sale_secondary_uom_id = pt.sale_secondary_uom_id
FROM product_template pt
WHERE pt.id = pp.product_tmpl_id
AND pt.sale_secondary_uom_id IS NOT NULL
"""
openupgrade.logged_query(env.cr, sql)

0 comments on commit 703ec24

Please sign in to comment.