优化收入确认

This commit is contained in:
27942
2026-02-01 17:36:37 +08:00
parent 609b66fe8a
commit 5db0af8360
3 changed files with 63 additions and 20 deletions

View File

@@ -2278,9 +2278,8 @@ class PaymentRequest(APIView):
# 如果团队不存在,默认按团队类型处理(需要审批)
pass
# 根据团队类型决定初始状态
# 如果是团队类型且需要审核,状态为"审核中";否则为"已通过"(直接抄送财务)
initial_state = "审核中" if (team and team.team_type == 'team') else "已通过"
# 付款申请统一都需要审批(无论团队类型)
initial_state = "审核中"
# 创建付款申请记录
pay = Payment.objects.create(
@@ -2316,7 +2315,7 @@ class PaymentRequest(APIView):
content_parts.insert(3, f"付款日期:{times}")
content = "".join(content_parts)
# 使用统一的审核流程函数(与离职逻辑一样
# 使用统一的审核流程函数(付款申请统一需要审批force_approval=True
from User.utils import create_approval_with_team_logic
approval, approvers_order_json, needs_approval = create_approval_with_team_logic(
@@ -2327,7 +2326,8 @@ class PaymentRequest(APIView):
approval_type="付款申请",
user_id=str(pay.id),
business_record=pay,
today=date_string
today=date_string,
force_approval=True # 付款申请统一需要审批
)
# 如果返回None且需要审核说明缺少审核人
@@ -2367,7 +2367,7 @@ class PaymentRequest(APIView):
'id': pay.id,
'state': pay.state,
'approval_id': approval.id if approval else None,
'needs_approval': team is None or team.team_type != 'personal', # 是否需要审批(前端用这个字段判断是团队还是个人)
'needs_approval': True, # 付款申请统一都需要审批
'team_type': team.team_type if team else None, # 团队类型personal/team前端用这个字段判断
'team_name': team_name # 团队名称
}
@@ -2653,9 +2653,8 @@ class reimbursement(APIView):
now = datetime.now()
date_string = now.strftime("%Y-%m-%d")
# 根据团队类型决定初始状态
# 如果是团队类型且需要审核,状态为"审核中";否则为"已通过"(直接抄送财务)
initial_state = "审核中" if (team and team.team_type == 'team') else "已通过"
# 报销统一都需要审批(无论团队类型)
initial_state = "审核中"
reim = Reimbursement.objects.create(
person=person,
@@ -2667,7 +2666,7 @@ class reimbursement(APIView):
state=initial_state
)
# 使用统一的审核流程函数
# 使用统一的审核流程函数报销统一需要审批force_approval=True
from User.utils import create_approval_with_team_logic
content = f"{person}{times}提交了报销申请,报销理由:{reason},报销金额:{amount},报销日期:{times},费用说明:{FeeDescription}"
@@ -2680,7 +2679,8 @@ class reimbursement(APIView):
approval_type="报销申请",
user_id=str(reim.id),
business_record=reim,
today=date_string
today=date_string,
force_approval=True # 报销统一需要审批
)
# 如果返回None且需要审核说明缺少审核人
@@ -2718,7 +2718,7 @@ class reimbursement(APIView):
'id': reim.id,
'state': reim.state,
'approval_id': approval.id if approval else None,
'needs_approval': team is None or team.team_type != 'personal', # 是否需要审批(前端用这个字段判断是团队还是个人)
'needs_approval': True, # 报销统一都需要审批
'team_type': team.team_type if team else None, # 团队类型personal/team前端用这个字段判断
'team_name': team_name # 团队名称
}
@@ -2918,9 +2918,8 @@ class Change(APIView):
except Team.DoesNotExist:
pass
# 根据团队类型决定初始状态
# 如果是团队类型且需要审核,状态为"审核中";否则为"已通过"(直接抄送财务)
initial_state = "审核中" if (team and team.team_type == 'team') else "已通过"
# 工资/奖金变更统一都需要审批(无论团队类型)
initial_state = "审核中"
bonus = BonusChange.objects.create(
username=username,
@@ -2935,7 +2934,7 @@ class Change(APIView):
content = f"{submitter}{date_string}提交了工资/奖金变更,类型:{type},调整说明:{Instructions}"
# 使用统一的审核流程函数(与付款申请、报销申请逻辑一样
# 使用统一的审核流程函数(工资/奖金变更统一需要审批force_approval=True
approval, approvers_order_json, needs_approval = create_approval_with_team_logic(
team_name=team_name,
approvers=approvers,
@@ -2944,7 +2943,8 @@ class Change(APIView):
approval_type="工资/奖金变更",
user_id=str(bonus.id),
business_record=bonus,
today=date_string
today=date_string,
force_approval=True # 工资/奖金变更统一需要审批
)
# 如果返回None且需要审核说明缺少审核人
@@ -2983,7 +2983,7 @@ class Change(APIView):
'submitter': bonus.submitter, # 提交人(明确是谁提交的申请)
'state': bonus.state,
'approval_id': approval.id if approval else None,
'needs_approval': team is None or team.team_type != 'personal', # 是否需要审批(前端用这个字段判断是团队还是个人)
'needs_approval': True, # 工资/奖金变更统一都需要审批
'team_type': team.team_type if team else None, # 团队类型personal/team前端用这个字段判断
'team_name': team_name # 团队名称
}