fix: normalize brand whitespace on product writes
This commit is contained in:
parent
6d6a1110a5
commit
aad91d223c
@ -504,6 +504,9 @@ def product_batch_update():
|
|||||||
for field, value in fields.items():
|
for field, value in fields.items():
|
||||||
if field not in allowed_fields:
|
if field not in allowed_fields:
|
||||||
continue
|
continue
|
||||||
|
# 品牌来自表格/剪贴板时可能带有尾部 Tab 或换行;只清理首尾空白,保留名称中的正常空格。
|
||||||
|
if field == 'brand' and isinstance(value, str):
|
||||||
|
value = value.strip()
|
||||||
if value == '' or value is None:
|
if value == '' or value is None:
|
||||||
value = None
|
value = None
|
||||||
# 数值字段范围校验
|
# 数值字段范围校验
|
||||||
@ -1105,7 +1108,7 @@ def product_create():
|
|||||||
VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)
|
VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)
|
||||||
""", (
|
""", (
|
||||||
product_code, product_name,
|
product_code, product_name,
|
||||||
data.get('brand', ''), data.get('product_type', '成品'),
|
(data.get('brand') or '').strip(), (data.get('product_type') or '成品').strip(),
|
||||||
int(data.get('lead_time', 0)), min(int(data.get('logistics_time', 0)), 999),
|
int(data.get('lead_time', 0)), min(int(data.get('logistics_time', 0)), 999),
|
||||||
data.get('supplier_code', ''), data.get('supplier_name', ''),
|
data.get('supplier_code', ''), data.get('supplier_name', ''),
|
||||||
data.get('procurement_follower', ''), data.get('procurement_planner', ''),
|
data.get('procurement_follower', ''), data.get('procurement_planner', ''),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user