From 313e9ed1cdbfb95fdf0905a7b46394612dcb550b Mon Sep 17 00:00:00 2001 From: caoqianming Date: Fri, 2 Aug 2024 11:14:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20routeserializer=E4=BC=98=E5=8C=96routepa?= =?UTF-8?q?ck=20process=E6=A0=A1=E9=AA=8C3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/mtm/serializers.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/mtm/serializers.py b/apps/mtm/serializers.py index d84577c1..198d4a60 100644 --- a/apps/mtm/serializers.py +++ b/apps/mtm/serializers.py @@ -215,8 +215,9 @@ class RouteSerializer(CustomModelSerializer): def create(self, validated_data): process = validated_data['process'] routepack = validated_data.get('routepack', None) - if routepack and Route.objects.filter(routepack=routepack, process=process).exists(): - raise ValidationError('已选择该工序!') + if routepack: + if Route.objects.filter(routepack=routepack, process=process).exists(): + raise ValidationError('已选择该工序!') else: material = validated_data.get('material', None) if material and process and Route.objects.filter(material=material, process=process).exists():