- 重构 finance_dashboard 口径计算,新增模拟公司画像数据生成与筛选 - 引入 expense_claim_status_registry 统一报销状态流转 - 完善报销草稿流程、Item Sync 与本体解析器 - 优化总览页趋势图、分页组件与请求进度步骤 - 增强报销申请快速预览、本体工具与详情展示 - 新增半年报销模拟数据种子脚本与状态审计工具 - 补充财务看板、报销状态注册与模拟数据测试覆盖
53 lines
1.6 KiB
Python
53 lines
1.6 KiB
Python
from app.services.expense_claim_status_registry import (
|
|
claim_status_code,
|
|
normalize_expense_claim_state,
|
|
)
|
|
from app.services.expense_claim_workflow_constants import (
|
|
APPROVAL_DONE_STAGE,
|
|
ARCHIVE_ACCOUNTING_STAGE,
|
|
FINANCE_APPROVAL_STAGE,
|
|
PAYMENT_PAID_STAGE,
|
|
PAYMENT_PENDING_STAGE,
|
|
)
|
|
|
|
|
|
def test_normalize_legacy_finance_review_to_submitted_finance_stage() -> None:
|
|
state = normalize_expense_claim_state(
|
|
"finance_review",
|
|
"finance_review",
|
|
claim_no="SIM-EXP-2026-0001",
|
|
expense_type="travel",
|
|
)
|
|
|
|
assert state.status == "submitted"
|
|
assert state.approval_stage == FINANCE_APPROVAL_STAGE
|
|
assert state.status_code == 20
|
|
assert state.changed is True
|
|
|
|
|
|
def test_normalize_reimbursement_archive_stage_differs_from_application_done() -> None:
|
|
reimbursement_state = normalize_expense_claim_state(
|
|
"approved",
|
|
"completed",
|
|
claim_no="SIM-EXP-2026-0002",
|
|
expense_type="travel",
|
|
)
|
|
application_state = normalize_expense_claim_state(
|
|
"approved",
|
|
"completed",
|
|
claim_no="AP-20260602-0001",
|
|
expense_type="travel_application",
|
|
)
|
|
|
|
assert reimbursement_state.approval_stage == ARCHIVE_ACCOUNTING_STAGE
|
|
assert application_state.approval_stage == APPROVAL_DONE_STAGE
|
|
|
|
|
|
def test_normalize_payment_stages_by_status() -> None:
|
|
pending_state = normalize_expense_claim_state("pending_payment", "payment")
|
|
paid_state = normalize_expense_claim_state("paid", "payment")
|
|
|
|
assert pending_state.approval_stage == PAYMENT_PENDING_STAGE
|
|
assert paid_state.approval_stage == PAYMENT_PAID_STAGE
|
|
assert claim_status_code("paid") == 50
|