From 6eec19948860fec4c6cd6641bc0729edba1b9e32 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Thu, 7 Nov 2024 09:40:32 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20mlog=20create=E6=97=B6=E6=A0=A1?= =?UTF-8?q?=E9=AA=8Cmtask=E6=98=AF=E5=90=A6=E6=98=AF=E4=B8=8B=E8=BE=BE?= =?UTF-8?q?=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wpm/serializers.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/wpm/serializers.py b/apps/wpm/serializers.py index 6a7f95e2..2ac94141 100644 --- a/apps/wpm/serializers.py +++ b/apps/wpm/serializers.py @@ -286,6 +286,9 @@ class MlogSerializer(CustomModelSerializer): def create(self, validated_data): material_out = validated_data['material_out'] + mtask:Mtask = validated_data.get('mtask', None) + if mtask and mtask.state != Mtask.MTASK_ASSGINED: + raise ParseError('该任务非下达中不可选择') with transaction.atomic(): mlogb = validated_data.pop('mlogb', []) instance: Mlog = super().create(validated_data)