feat: handover根据wm完善batch字段

This commit is contained in:
caoqianming 2025-05-26 12:10:47 +08:00
parent 6539bc2e61
commit f41068e923
2 changed files with 3 additions and 1 deletions

View File

@ -1013,6 +1013,8 @@ class HandoverSerializer(CustomModelSerializer):
wm:WMaterial = attrs.get('wm', None)
if wm:
attrs["batch"] = wm.batch
handoverb = attrs.get('handoverb', [])
if wm and not handoverb:
attrs['handoverb'] = [{"wm": wm, "count": attrs["count"] }]

View File

@ -383,7 +383,7 @@ class HandoverViewSet(CustomModelViewSet):
select_related_fields = ['send_user', 'send_mgroup', 'send_dept', 'recive_user', 'recive_mgroup', 'recive_dept', 'wm']
filterset_class = HandoverFilter
search_fields = ['id', 'material__name',
'material__number', 'material__specification', 'batch', 'material__model', 'b_handover__batch', "new_batch"]
'material__number', 'material__specification', 'batch', 'material__model', 'b_handover__batch', "new_batch", "wm__batch"]
prefetch_related_fields = ["b_handover"]
def perform_destroy(self, instance):