处理#6973任务:

1货位编码规则简化
2货位看板直观化展示
This commit is contained in:
huziyang@jikimo.com
2025-06-09 09:49:21 +08:00
parent 61bcd72a41
commit 25b53794bb
6 changed files with 1903 additions and 1615 deletions

View File

@@ -0,0 +1,15 @@
from odoo import api, SUPERUSER_ID
def migrate(cr, version):
env = api.Environment(cr, SUPERUSER_ID, {})
sf_shelf_model = env["sf.shelf"]
sf_shelf_location_model = env["sf.shelf.location"]
shelves = sf_shelf_model.search([])
for shelf in shelves:
shelf_barcode = shelf.barcode or ""
if not shelf_barcode:
continue
locations = sf_shelf_location_model.search([("shelf_id", "=", shelf.id)], order="id asc")
for index, location in enumerate(locations, start=1):
new_barcode = f"{shelf_barcode}-{index:03d}"
location.barcode = new_barcode