Stock: Fix serializers.py

- Use of read_only PrimaryKeyRelatedField was breaking POST via API
This commit is contained in:
Oliver Walters 2020-08-31 20:08:07 +10:00
parent fa540c0096
commit 8615cad711
3 changed files with 4 additions and 19 deletions

View File

@ -186,7 +186,7 @@ class StockCount(StockAdjust):
class StockAdd(StockAdjust):
"""
Endpoint for adding stock
Endpoint for adding a quantity of stock to an existing StockItem
"""
def post(self, request, *args, **kwargs):
@ -204,7 +204,7 @@ class StockAdd(StockAdjust):
class StockRemove(StockAdjust):
"""
Endpoint for removing stock.
Endpoint for removing a quantity of stock from an existing StockItem.
"""
def post(self, request, *args, **kwargs):

View File

@ -99,26 +99,10 @@ class StockItemSerializer(InvenTreeModelSerializer):
return queryset
belongs_to = serializers.PrimaryKeyRelatedField(read_only=True)
build_order = serializers.PrimaryKeyRelatedField(read_only=True)
customer = serializers.PrimaryKeyRelatedField(read_only=True)
location = serializers.PrimaryKeyRelatedField(read_only=True)
in_stock = serializers.BooleanField(read_only=True)
sales_order = serializers.PrimaryKeyRelatedField(read_only=True)
status_text = serializers.CharField(source='get_status_display', read_only=True)
supplier_part = serializers.PrimaryKeyRelatedField(read_only=True)
supplier_part_detail = SupplierPartSerializer(source='supplier_part', many=False, read_only=True)
part = serializers.PrimaryKeyRelatedField(read_only=True)
part_detail = PartBriefSerializer(source='part', many=False, read_only=True)
location_detail = LocationBriefSerializer(source='location', many=False, read_only=True)

View File

@ -24,4 +24,5 @@ django-stdimage==5.1.1 # Advanced ImageField management
django-tex==1.1.7 # LaTeX PDF export
django-weasyprint==1.0.1 # HTML PDF export
django-debug-toolbar==2.2 # Debug / profiling toolbar
inventree # Install the latest version of the InvenTree API python library