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:
@@ -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')
|
||||
# 金额类字段统一要求 > 0(amount ≤ 0 视为非法)
|
||||
if amount <= 0:
|
||||
# 与 API 文档/测试约定保持一致
|
||||
raise ValueError(f'{field_name} 必须大于 0')
|
||||
return amount
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user