From 28882ae074339ad55059c32294080a204e5848b8 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Thu, 20 Jan 2022 15:44:27 +0800 Subject: [PATCH] =?UTF-8?q?wproductserializer=20=E5=A2=9E=E5=8A=A0to=5Ford?= =?UTF-8?q?er=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hb_server/apps/wpm/serializers.py | 1 + hb_server/apps/wpm/views.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/hb_server/apps/wpm/serializers.py b/hb_server/apps/wpm/serializers.py index 3e245ef..3181088 100644 --- a/hb_server/apps/wpm/serializers.py +++ b/hb_server/apps/wpm/serializers.py @@ -156,6 +156,7 @@ class WProductListSerializer(serializers.ModelSerializer): subproduction_plan_ = SubproductionPlanSimpleSerializer(source='subproduction_plan', read_only=True) warehouse_ = WareHouseSimpleSerializer(source='warehouse', read_only=True) children = serializers.SerializerMethodField() + to_order_ = OrderSimpleSerializer(source='to_order', read_only=True) class Meta: model = WProduct fields = '__all__' diff --git a/hb_server/apps/wpm/views.py b/hb_server/apps/wpm/views.py index 5847c89..47c49dc 100644 --- a/hb_server/apps/wpm/views.py +++ b/hb_server/apps/wpm/views.py @@ -148,7 +148,7 @@ class WProductViewSet(ListModelMixin, RetrieveModelMixin, GenericViewSet): """ perms_map = {'*': '*'} queryset = WProduct.objects.select_related('step', 'material', - 'subproduction_plan', 'warehouse').prefetch_related('wproduct_child') + 'subproduction_plan', 'warehouse', 'order').prefetch_related('wproduct_child') serializer_class = WProductListSerializer filterset_class = WProductFilterSet search_fields = ['number']