diff --git a/apps/mtm/serializers.py b/apps/mtm/serializers.py index 77d58044..6f94984c 100644 --- a/apps/mtm/serializers.py +++ b/apps/mtm/serializers.py @@ -134,7 +134,7 @@ class RoutePackSerializer(CustomModelSerializer): class Meta: model = RoutePack fields = '__all__' - read_only_fields = EXCLUDE_FIELDS + ['state'] + read_only_fields = EXCLUDE_FIELDS + ['state', 'ticket'] def update(self, instance, validated_data): if validated_data['material'] != instance.material: @@ -161,6 +161,8 @@ class RouteSerializer(CustomModelSerializer): read_only_fields = EXCLUDE_FIELDS def validate(self, attrs): + if 'routepack' in attrs: + attrs['material'] = attrs['routepack'].material if 'mgroup' in attrs and attrs['mgroup']: attrs['process'] = attrs['mgroup'].process if attrs.get('process', None) is None: