1
0
forked from erp-dev/erp

test: before all tests

This commit is contained in:
2025-12-25 21:36:50 +08:00
parent 147b5804d2
commit c0277a8218
18 changed files with 310 additions and 89 deletions

View File

@@ -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)
# 金额类字段统一要求 > 0amount ≤ 0 视为非法
if amount <= 0:
# 与 API 文档/测试约定保持一致
raise ValueError(f'{field_name} 必须大于 0')
# 金额类字段要求非零(允许负数用于处理退款场景
# 付款单负金额 = 供应商退款,收款单负金额 = 退款给客户
if amount == 0:
raise ValueError(f'{field_name} 不能为 0')
return amount