forked from erp-dev/erp
test: before all tests
This commit is contained in:
@@ -1723,10 +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)
|
||||
# 金额类字段统一要求 > 0(amount ≤ 0 视为非法)
|
||||
if amount <= 0:
|
||||
# 与 API 文档/测试约定保持一致
|
||||
raise ValueError(f'{field_name} 必须大于 0')
|
||||
# 金额类字段要求非零(允许负数用于处理退款场景)
|
||||
# 付款单负金额 = 供应商退款,收款单负金额 = 退款给客户
|
||||
if amount == 0:
|
||||
raise ValueError(f'{field_name} 不能为 0')
|
||||
return amount
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user