Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions stock_ux/migrations/18.0.1.5.0/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<<<<<<< HEAD
||||||| MERGE BASE
=======
# Copyright 2025 ADHOC SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

import logging

_logger = logging.getLogger(__name__)


def migrate(cr, version):
"""Create qty_to_order_computed column and warehouse_id index.

Backport from v19: Adds stored qty_to_order_computed column and
warehouse_id index to improve query performance.
"""
# Create qty_to_order_computed column if it doesn't exist
cr.execute("""
ALTER TABLE stock_warehouse_orderpoint
ADD COLUMN IF NOT EXISTS qty_to_order_computed numeric
""")

# Create index on warehouse_id if it doesn't exist
cr.execute("""
CREATE INDEX IF NOT EXISTS stock_warehouse_orderpoint_warehouse_id_index
ON stock_warehouse_orderpoint (warehouse_id)
""")

>>>>>>> FORWARD PORTED
Loading