feat: 财务看板口径重构与半年模拟数据及报销状态注册表
- 重构 finance_dashboard 口径计算,新增模拟公司画像数据生成与筛选 - 引入 expense_claim_status_registry 统一报销状态流转 - 完善报销草稿流程、Item Sync 与本体解析器 - 优化总览页趋势图、分页组件与请求进度步骤 - 增强报销申请快速预览、本体工具与详情展示 - 新增半年报销模拟数据种子脚本与状态审计工具 - 补充财务看板、报销状态注册与模拟数据测试覆盖
This commit is contained in:
@@ -31,7 +31,12 @@ BUDGET_MONITOR_APPROVAL_GRADE = "P8"
|
||||
CLAIM_DELETE_ROLE_CODES = {"executive"}
|
||||
ARCHIVED_CLAIM_STATUSES = ("approved", "completed", "paid")
|
||||
APPLICATION_ARCHIVED_STAGES = (APPROVAL_DONE_STAGE, "申请归档", "completed")
|
||||
ARCHIVED_REIMBURSEMENT_STAGES = (ARCHIVE_ACCOUNTING_STAGE, PAYMENT_PAID_STAGE, "completed")
|
||||
ARCHIVED_REIMBURSEMENT_STAGES = (
|
||||
ARCHIVE_ACCOUNTING_STAGE,
|
||||
PAYMENT_PAID_STAGE,
|
||||
"payment",
|
||||
"completed",
|
||||
)
|
||||
|
||||
|
||||
class ExpenseClaimAccessPolicy:
|
||||
@@ -640,9 +645,23 @@ class ExpenseClaimAccessPolicy:
|
||||
include_approval_scope: bool = False,
|
||||
) -> Any:
|
||||
conditions = self.build_personal_claim_conditions(current_user)
|
||||
role_codes = self.normalize_role_codes(current_user)
|
||||
|
||||
if self.has_privileged_claim_access(current_user):
|
||||
company_reimbursement_condition = and_(
|
||||
func.lower(func.coalesce(ExpenseClaim.status, "")) != "draft",
|
||||
func.lower(func.coalesce(ExpenseClaim.expense_type, "")) != "application",
|
||||
~func.lower(func.coalesce(ExpenseClaim.expense_type, "")).like(
|
||||
"%\\_application",
|
||||
escape="\\",
|
||||
),
|
||||
~func.upper(func.coalesce(ExpenseClaim.claim_no, "")).like("AP-%"),
|
||||
~func.upper(func.coalesce(ExpenseClaim.claim_no, "")).like("APP-%"),
|
||||
~self.build_archived_claim_condition(),
|
||||
)
|
||||
conditions.append(company_reimbursement_condition)
|
||||
|
||||
if include_approval_scope:
|
||||
role_codes = self.normalize_role_codes(current_user)
|
||||
if current_user.is_admin or "executive" in role_codes:
|
||||
conditions.append(ExpenseClaim.status.in_(("submitted", PAYMENT_PENDING_STATUS, "returned")))
|
||||
elif "finance" in role_codes:
|
||||
|
||||
Reference in New Issue
Block a user