1
0
forked from erp-dev/erp

feat: added n-to-1 relation between sales_order_item and printing_job model

This commit is contained in:
2025-12-11 18:09:10 +08:00
parent 633031d7cb
commit 1a8c446365
30 changed files with 41736 additions and 40 deletions

View File

@@ -226,6 +226,18 @@ def pick_product(fields: dict) -> Product:
从字段字典中提取产品信息
"""
data = {k: fields.get(v, '') for k, v in product_type_map.items()}
def _to_int(value):
if value in ('', None):
return None
try:
return int(value)
except (TypeError, ValueError):
return None
data['pieces'] = _to_int(data.get('pieces'))
data['segment_size'] = _to_int(data.get('segment_size'))
return Product(**data)