打通 T+ 快照、业务、发货、回款和核算准备链路,保留来源差异并提供待补状态。 新增业务自动接入任务、跨平台读取服务托管、权限复核、来源关联和前端核对页面。 补充迁移、隔离集成测试、浏览器模拟验收及角色授权边界修复。
39 lines
1.3 KiB
Python
39 lines
1.3 KiB
Python
"""人工确认绑定被核对内容,不能由核算状态、凭证或同步状态推导。"""
|
|
|
|
from datetime import date, datetime
|
|
from decimal import Decimal
|
|
|
|
from app.models import Receipt
|
|
from app.services import receipt_confirmation
|
|
from app.services.param_service import ParamSnapshot
|
|
|
|
|
|
def receipt():
|
|
return Receipt(id=1, business_id=2, receipt_date=date(2026, 3, 10), amount=Decimal("100"), is_barter=0)
|
|
|
|
|
|
def test_人工确认默认开启且与工资审批独立(monkeypatch):
|
|
monkeypatch.setattr(receipt_confirmation, "resolve_snapshot", lambda *args: ParamSnapshot.from_rows(date.today(), []))
|
|
assert receipt_confirmation.enabled(None)
|
|
|
|
|
|
def test_已核算及同步来源不能替代确认():
|
|
row = receipt()
|
|
row.settlement_status = 1
|
|
row.t_plus_id = "source1"
|
|
row.sync_batch_no = "SYNC-SUCCEEDED"
|
|
assert not receipt_confirmation.is_confirmed(row)
|
|
|
|
|
|
def test_关键内容变化使确认失效而备注不影响():
|
|
row = receipt()
|
|
row.confirmation_status = 1
|
|
row.confirmed_by = "test_operator"
|
|
row.confirmed_at = datetime.now()
|
|
row.confirmed_revision = receipt_confirmation.revision(row)
|
|
assert receipt_confirmation.is_confirmed(row)
|
|
row.remark = "只改备注"
|
|
assert receipt_confirmation.is_confirmed(row)
|
|
row.amount = Decimal("101")
|
|
assert not receipt_confirmation.is_confirmed(row)
|