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:
@@ -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):
|
||||
|
Reference in New Issue
Block a user