fix: handover serializer bug
This commit is contained in:
parent
bad338ba67
commit
67ca07bb35
|
@ -341,7 +341,9 @@ class HandoverSerializer(CustomModelSerializer):
|
|||
if attrs.get('wm', None):
|
||||
material = attrs['wm'].material
|
||||
attrs['material'] = attrs['wm'].material
|
||||
attrs['batch'] = attrs['wm'].batch
|
||||
attrs['send_dept'] = attrs['wm'].belong_dept
|
||||
if attrs['wm'].mgroup:
|
||||
attrs['send_mgroup'] = attrs['wm'].mgroup
|
||||
if material.process and material.process.into_wm_mgroup and 'recive_mgroup' not in attrs:
|
||||
raise ValidationError('必须指定交接工段')
|
||||
|
@ -354,7 +356,7 @@ class HandoverSerializer(CustomModelSerializer):
|
|||
class Meta:
|
||||
model = Handover
|
||||
fields = '__all__'
|
||||
read_only_fields = EXCLUDE_FIELDS + ["batch", "material", "send_dept", "send_mgroup", "mlog"]
|
||||
read_only_fields = EXCLUDE_FIELDS + ["batch", "material", "send_dept", "mlog"]
|
||||
extra_kwargs = {
|
||||
"wm": {"required": True},
|
||||
"recive_mgroup": {"required": False}
|
||||
|
|
Loading…
Reference in New Issue