2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-08-20 02:15:53 +00:00

JSON api for stock items

This commit is contained in:
Oliver
2018-04-29 21:02:40 +10:00
parent 9cc0780367
commit f74e176579
4 changed files with 64 additions and 53 deletions

View File

@@ -3,32 +3,40 @@ from rest_framework import serializers
from .models import StockItem, StockLocation
class StockItemSerializer(serializers.HyperlinkedModelSerializer):
class StockItemSerializer(serializers.ModelSerializer):
""" Serializer for a StockItem
"""
class Meta:
model = StockItem
fields = ('url',
'part',
'supplier_part',
'location',
'quantity',
'status',
'notes',
'updated',
'stocktake_date',
'stocktake_user',
'review_needed',
'expected_arrival')
fields = [
'pk',
'url',
'part',
'supplier_part',
'location',
'belongs_to',
'customer',
'quantity',
'serial',
'batch',
'status',
'notes',
'updated',
'stocktake_date',
'stocktake_user',
'review_needed',
]
""" These fields are read-only in this context.
They can be updated by accessing the appropriate API endpoints
"""
read_only_fields = ('stocktake_date',
'stocktake_user',
'updated',
'quantity',)
read_only_fields = [
'stocktake_date',
'stocktake_user',
'updated',
'quantity',
]
class StockQuantitySerializer(serializers.ModelSerializer):