1
0
forked from erp-dev/erp

feat: refactor flower.utils to sub package, added some sync api in package, added plate_order sync result model but relation of plate_order was not query (do it next step)

This commit is contained in:
2025-12-17 17:37:39 +08:00
parent 51fad953c3
commit 98d797221a
19 changed files with 1422 additions and 403 deletions

View File

@@ -1723,8 +1723,10 @@ def _to_decimal(value, field_name: str) -> Decimal:
def _ensure_non_zero_amount(value, field_name: str) -> Decimal:
amount = _to_decimal(value, field_name)
if amount == 0:
raise ValueError(f'{field_name} 不能为 0')
# 金额类字段统一要求 > 0amount ≤ 0 视为非法)
if amount <= 0:
# 与 API 文档/测试约定保持一致
raise ValueError(f'{field_name} 必须大于 0')
return amount