mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Pepe fixes
This commit is contained in:
parent
8ec4101edd
commit
395db4df38
@ -11,6 +11,7 @@ from stock.serializers import StockItemSerializerBrief
|
||||
|
||||
from .models import Build, BuildItem
|
||||
|
||||
|
||||
class BuildSerializer(InvenTreeModelSerializer):
|
||||
""" Serializes a Build object """
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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',
|
||||
|
Loading…
Reference in New Issue
Block a user