diff --git a/hb_server/apps/srm/serializers.py b/hb_server/apps/srm/serializers.py index a142348..59d7be9 100644 --- a/hb_server/apps/srm/serializers.py +++ b/hb_server/apps/srm/serializers.py @@ -1,21 +1,24 @@ from rest_framework import serializers from apps.pm.models import ProductionPlan, SubProductionPlan -from apps.mtm.serializers import ProcessSimpleSerializer +from apps.mtm.serializers import MaterialSimpleSerializer, ProcessSimpleSerializer class SubplanGanttSerializer(serializers.ModelSerializer): count = serializers.IntegerField(source='main_count') count_real = serializers.IntegerField(source='main_count_real') count_ok = serializers.IntegerField(source='main_count_ok') process_ = ProcessSimpleSerializer(source='process', read_only=True) + product_ = MaterialSimpleSerializer(source='main_product', read_only=True) class Meta: model = SubProductionPlan fields = ['id', 'number', 'start_date', 'end_date', 'count', 'count_real', 'count_ok', 'start_date_real', 'end_date_real', 'process_'] class PlanGanttSerializer(serializers.ModelSerializer): children = serializers.SerializerMethodField() + product_ = MaterialSimpleSerializer(source='product', read_only=True) class Meta: model = ProductionPlan - fields = ['id', 'number', 'start_date', 'end_date', 'children', 'count', 'count_real', 'count_ok'] + fields = ['id', 'number', 'start_date', 'end_date', 'children', 'count', 'count_real', + 'count_ok', 'product', 'product_'] def get_children(self, obj): subplans = SubProductionPlan.objects.filter(production_plan=obj).order_by('process__number')