addons-cm/website_sale_aplicoop/migrations/18.0.1.9.0/pre-migrate.py
snt f8ef927a9e [IMP] website_sale_aplicoop: add sequence field to product.category for web ordering
- Add sequence field (default 10) to product.category with _order = "sequence, name"
- Inherit product.category tree view to add drag-handle widget
- Sort category hierarchy and available categories by sequence in controller
- Migration 18.0.1.9.0: add sequence column to product_category table
- Bump version to 18.0.1.9.0
2026-05-20 16:05:14 +02:00

13 lines
419 B
Python

"""Add sequence field to product.category.
Ensures the sequence column exists with a default of 10 for all existing rows.
The ORM will also handle this on upgrade, but we add it explicitly so the
column is present before any post-install logic runs.
"""
def migrate(cr, version):
cr.execute("""
ALTER TABLE product_category
ADD COLUMN IF NOT EXISTS sequence INTEGER NOT NULL DEFAULT 10;
""")