From ccb637773f81304c311e2a9f8a7334ff66a66e73 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Fri, 3 Apr 2020 11:41:51 +1100 Subject: [PATCH] Add item count to StockLocation serializer --- InvenTree/stock/serializers.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/InvenTree/stock/serializers.py b/InvenTree/stock/serializers.py index 14fe043564..f84667e352 100644 --- a/InvenTree/stock/serializers.py +++ b/InvenTree/stock/serializers.py @@ -119,6 +119,8 @@ class LocationSerializer(InvenTreeModelSerializer): url = serializers.CharField(source='get_absolute_url', read_only=True) + items = serializers.IntegerField(source='item_count', read_only=True) + class Meta: model = StockLocation fields = [ @@ -127,7 +129,8 @@ class LocationSerializer(InvenTreeModelSerializer): 'name', 'description', 'parent', - 'pathstring' + 'pathstring', + 'items', ]