diff --git a/apps/wpm/serializers.py b/apps/wpm/serializers.py index 8143d366..107d0909 100644 --- a/apps/wpm/serializers.py +++ b/apps/wpm/serializers.py @@ -1189,14 +1189,15 @@ class HandoverSerializer(CustomModelSerializer): def validate(self, attrs): if "mtype" not in attrs: attrs['mtype'] = Handover.H_NORMAL - mtype = attrs["mtype"] if 'type' not in attrs: attrs['type'] = Handover.H_NORMAL + if attrs["type"] == Handover.H_CHANGE: + attrs["mtype"] = Handover.H_MERGE if "material_changed" not in attrs: raise ParseError("必须指定改版后的物料") - if mtype == Handover.H_MERGE: + if attrs["mtype"] == Handover.H_MERGE: new_state = None new_wm:WMaterial = attrs.get("new_wm", None) if new_wm: diff --git a/apps/wpm/services.py b/apps/wpm/services.py index f6d1a27c..7bb9a5d5 100644 --- a/apps/wpm/services.py +++ b/apps/wpm/services.py @@ -720,8 +720,6 @@ def handover_submit(handover:Handover, user: User, now: Union[datetime.datetime, recive_mgroup = handover.recive_mgroup recive_dept = handover.recive_dept - if handover.type == Handover.H_CHANGE: - handover.mtype = Handover.H_MERGE new_batch = handover.new_batch if new_batch and mtype != Handover.H_MERGE: raise ParseError("只有合并时才能提供新批次号")