fix: handover validate bug
This commit is contained in:
parent
d579a7358d
commit
a6a3dcf33c
|
|
@ -338,12 +338,13 @@ class HandoverSerializer(CustomModelSerializer):
|
|||
source='material', read_only=True)
|
||||
|
||||
def validate(self, attrs):
|
||||
material: Material = attrs['material']
|
||||
if material.process.into_wm_mgroup and 'recive_mgroup' not in attrs:
|
||||
raise ValidationError('必须指定交接工段')
|
||||
if attrs.get('wm', None):
|
||||
material = attrs['wm'].material
|
||||
attrs['material'] = attrs['wm'].material
|
||||
attrs['send_dept'] = attrs['wm'].belong_dept
|
||||
attrs['send_mgroup'] = attrs['wm'].mgroup
|
||||
if material.process and material.process.into_wm_mgroup and 'recive_mgroup' not in attrs:
|
||||
raise ValidationError('必须指定交接工段')
|
||||
if attrs.get('recive_mgroup', None):
|
||||
attrs['recive_dept'] = attrs['recive_mgroup'].belong_dept
|
||||
if 'recive_dept' not in attrs and 'recive_mgroup' not in attrs:
|
||||
|
|
|
|||
Loading…
Reference in New Issue