Skip to content

Commit

Permalink
Merge pull request #1251 from hanshuaikang/feature/develop_by_han
Browse files Browse the repository at this point in the history
fix: 修复state_processors允许为空的问题
  • Loading branch information
hanshuaikang authored Dec 25, 2023
2 parents bf20d1f + 6d61dcd commit ad3e086
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions itsm/ticket/serializers/ticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -961,6 +961,13 @@ def run_validation(self, data):
except TicketStatus.DoesNotExist:
raise serializers.ValidationError({_("工单状态"): _("工单状态不存在,请检查")})

state_processors = data.get("meta", {}).get("state_processors", {})
for state_id, state_processor in state_processors.items():
if not state_processor:
raise serializers.ValidationError(
{"state_processors": _("节点 {} 对应的审批人不允许为空".format(state_id))}
)

# 创建单据时,若没有传入creator参数,则采用request的当前用户
creator = data.get("creator", self.context["request"].user.username)
data.update(
Expand Down

0 comments on commit ad3e086

Please sign in to comment.