ERP: unique index item_code, dokumentasi README, migration script update

This commit is contained in:
2026-09-07 15:47:23 +07:00
parent 83af01630c
commit fff2274ce1
2 changed files with 23 additions and 2 deletions

View File

@@ -1,6 +1,12 @@
import re
# Migration: isi code kategori & item_code produk untuk data existing
env.cr.execute(
"CREATE UNIQUE INDEX IF NOT EXISTS product_template_item_code_uniq "
"ON product_template (item_code) WHERE item_code IS NOT NULL"
)
env.cr.commit()
cats = env['product.category'].search([])
for c in cats:
if not c.code: