fix: ticket bug

This commit is contained in:
feng626
2021-09-13 20:08:39 +08:00
committed by Jiangjie.Bai
parent 6695d0a8a2
commit 55a5dd1e34
3 changed files with 10 additions and 4 deletions

View File

@@ -157,6 +157,12 @@ class TicketFlowApproveSerializer(serializers.ModelSerializer):
return obj.assignees.values_list('id', flat=True)
return []
def validate(self, attrs):
if attrs['strategy'] == TicketApprovalStrategy.custom_user and not attrs.get('assignees'):
error = _('Please select the Assignees')
raise serializers.ValidationError(error)
return super().validate(attrs)
class TicketFlowSerializer(OrgResourceModelSerializerMixin):
type_display = serializers.ReadOnlyField(source='get_type_display', label=_('Type display'))