fix: 运费金额为空时返回空值,便于顺丰批次展示月结
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
92c59d67b4
commit
dd00dba39c
3 files changed
+48
-2
No files matched your search
@@ -181,3 +181,33 @@ def test_freight_model_allows_null_amount_and_settlement_columns():
|
||||
assert cols["waybill_no"].nullable is True
|
||||
assert cols["settle_status"].nullable is True
|
||||
assert cols["settle_time"].nullable is True
|
||||
|
||||
|
||||
def test_amount_serializer_keeps_null_instead_of_zero():
|
||||
from types import SimpleNamespace
|
||||
from app.crud.sample_freight import _row_to_dict
|
||||
from app.services.market_freight import _batch_dict
|
||||
|
||||
obj = SimpleNamespace(
|
||||
id="f1",
|
||||
freight_no="YF1",
|
||||
transport_mode="sfkd",
|
||||
freight_amount=None,
|
||||
waybill_no=None,
|
||||
settle_status="wjs",
|
||||
settle_time=None,
|
||||
tenant_no="zkxw",
|
||||
order_num=0,
|
||||
remark="",
|
||||
create_by="u1",
|
||||
create_time=None,
|
||||
update_time=None,
|
||||
)
|
||||
admin = _row_to_dict(obj, transport_mode_label="顺丰快递", create_by_name="张三")
|
||||
market = _batch_dict(obj, 1, "顺丰快递", "张三")
|
||||
assert admin["freightAmount"] is None
|
||||
assert admin["waybillNo"] == ""
|
||||
assert admin["settleStatus"] == "wjs"
|
||||
assert admin["freightAmountLabel"] == "月结"
|
||||
assert market["freightAmount"] is None
|
||||
assert market["freightAmountLabel"] == "月结"
|
||||
Reference in new issue
Block a user