wproductticket list返回增加order product

This commit is contained in:
caoqianming 2021-12-31 10:45:21 +08:00
parent 895ffbe394
commit 7861b5419e
2 changed files with 6 additions and 1 deletions

View File

@ -12,6 +12,7 @@ from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from apps.pm.serializers import SubproductionPlanSimpleSerializer
from apps.qm.models import TestRecord, TestRecordItem
from apps.sam.serializers import OrderSimpleSerializer
from apps.system.serializers import UserSimpleSerializer
from apps.wpm.models import Operation, OperationEquip, OperationMaterial, OperationWproduct, Pick, WMaterial, WProduct, OperationRecord, OperationRecordItem, WprouctTicket
from django.db import transaction
@ -437,7 +438,10 @@ class WproductTicketListSerializer(serializers.ModelSerializer):
step_ = StepSimpleSerializer(source='step', read_only=True)
subproduction_plan_ = SubproductionPlanSimpleSerializer(source='subproduction_plan', read_only=True)
resp_process_ = ProcessSimpleSerializer(source='resp_process', read_only=True)
order_ = OrderSimpleSerializer(source='subproduction_plan.production_plan.order', read_only=True)
product_ = MaterialSimpleSerializer(source='subproduction_plan.production_plan.product', read_only=True)
class Meta:
model = WprouctTicket
fields = '__all__'

View File

@ -429,7 +429,8 @@ class WproductTicketViewSet(ListModelMixin, GenericViewSet):
玻璃审批工单
"""
perms_map={'*':'*'}
queryset = WprouctTicket.objects.select_related('step', 'material', 'subproduction_plan', 'resp_process')
queryset = WprouctTicket.objects.select_related('step', 'material', 'subproduction_plan',
'resp_process', 'subproduction_plan__production_plan__order', 'subproduction_plan__production_plan')
serializer_class = WproductTicketListSerializer
filterset_fields = ['step', 'material', 'subproduction_plan', 'resp_process']
ordering_fields = ['id']