From 395db4df383a3587404e053dd20a7d7d02bef976 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Tue, 30 Apr 2019 00:18:58 +1000 Subject: [PATCH] Pepe fixes --- InvenTree/build/serializers.py | 1 + InvenTree/part/views.py | 4 ++-- InvenTree/stock/serializers.py | 23 +++-------------------- 3 files changed, 6 insertions(+), 22 deletions(-) diff --git a/InvenTree/build/serializers.py b/InvenTree/build/serializers.py index 8ad09f616b..ed4d3b7b55 100644 --- a/InvenTree/build/serializers.py +++ b/InvenTree/build/serializers.py @@ -11,6 +11,7 @@ from stock.serializers import StockItemSerializerBrief from .models import Build, BuildItem + class BuildSerializer(InvenTreeModelSerializer): """ Serializes a Build object """ diff --git a/InvenTree/part/views.py b/InvenTree/part/views.py index 5428daa0ad..a00e8f8e63 100644 --- a/InvenTree/part/views.py +++ b/InvenTree/part/views.py @@ -390,7 +390,7 @@ class BomItemCreate(AjaxCreateView): - Do not allow part to be added to its own BOM - Remove any Part items that are already in the BOM """ - + form = super(AjaxCreateView, self).get_form() part_id = form['part'].value() @@ -405,7 +405,7 @@ class BomItemCreate(AjaxCreateView): query = query.exclude(id=part.id) # Eliminate any options that are already in the BOM! - query = query.exclude(id__in=[item.id for item in part.required_parts()]) + query = query.exclude(id__in=[item.id for item in part.required_parts()]) form.fields['sub_part'].queryset = query except Part.DoesNotExist: diff --git a/InvenTree/stock/serializers.py b/InvenTree/stock/serializers.py index a6780faf15..269e3b4e78 100644 --- a/InvenTree/stock/serializers.py +++ b/InvenTree/stock/serializers.py @@ -29,35 +29,18 @@ class LocationBriefSerializer(serializers.ModelSerializer): class StockItemSerializerBrief(serializers.ModelSerializer): - """ - Provide a brief serializer for StockItem - """ - - url = serializers.CharField(source='get_absolute_url', read_only=True) + """ Brief serializers for a StockItem """ + location_name = serializers.CharField(source='location', read_only=True) part_name = serializers.CharField(source='part.name', read_only=True) - class Meta: - model = StockItem - fields = [ - 'pk', - 'uuid', - 'url', - 'part_name', - ] - - -class StockItemSerializerBrief(serializers.ModelSerializer): - """ Brief serializers for a StockItem """ - - location_name = serializers.CharField(source='location', read_only=True) - class Meta: model = StockItem fields = [ 'pk', 'uuid', 'part', + 'part_name', 'supplier_part', 'location', 'location_name',