优化收入确认

This commit is contained in:
27942
2026-02-01 17:07:08 +08:00
parent dcbf5bb829
commit 609b66fe8a
2 changed files with 16 additions and 4 deletions

View File

@@ -1774,7 +1774,17 @@ class approvalProcessing(APIView):
}
}, status=status.HTTP_200_OK)
# 兼容旧流程:如果负责人未填写分配,但审批人指定了分配方案
# 审批人审批时必须填写收入分配
# 如果收入分配还是"待负责人指定",且审批人要通过审批,则必须填写收入分配
if state == "已通过" and income.allocate == "待负责人指定":
if not allocate:
return Response({
'status': 'error',
'message': '请填写收入分配后再通过审批',
'code': 1
}, status=status.HTTP_400_BAD_REQUEST)
# 如果审批人填写了收入分配,更新到记录中
if allocate:
income.allocate = allocate
# 更新审批内容,添加分配信息
@@ -1785,8 +1795,9 @@ class approvalProcessing(APIView):
else:
approval.content = approval.content + f",收入分配:{allocate}"
income.save(update_fields=['allocate'])
approval.save(update_fields=['content'])
# 使用统一的审核流程处理函数(兼容旧流程)
# 使用统一的审核流程处理函数
# 非财务查看时state参数是必填的
if not state:
return Response({'status': 'error', 'message': '缺少参数state审核状态已通过/未通过)', 'code': 1}, status=status.HTTP_400_BAD_REQUEST)