diff --git a/InvenTree/stock/api.py b/InvenTree/stock/api.py
index 571c856857..b0d3b3bd62 100644
--- a/InvenTree/stock/api.py
+++ b/InvenTree/stock/api.py
@@ -71,6 +71,11 @@ class StockDetail(generics.RetrieveUpdateDestroyAPIView):
except AttributeError:
pass
+ try:
+ kwargs['supplier_detail'] = str2bool(self.request.GET.get('supplier_detail', False))
+ except AttributeError:
+ pass
+
kwargs['context'] = self.get_serializer_context()
return self.serializer_class(*args, **kwargs)
diff --git a/InvenTree/stock/models.py b/InvenTree/stock/models.py
index 554fb00495..ff0cf7b21a 100644
--- a/InvenTree/stock/models.py
+++ b/InvenTree/stock/models.py
@@ -410,9 +410,13 @@ class StockItem(MPTTModel):
return True
+ @property
+ def tracking_info_count(self):
+ return self.tracking_info.count()
+
@property
def has_tracking_info(self):
- return self.tracking_info.count() > 0
+ return self.tracking_info_count > 0
def addTransactionNote(self, title, user, notes='', url='', system=True):
""" Generation a stock transaction note for this item.
diff --git a/InvenTree/stock/serializers.py b/InvenTree/stock/serializers.py
index de9e8c50ce..ce4041fec3 100644
--- a/InvenTree/stock/serializers.py
+++ b/InvenTree/stock/serializers.py
@@ -8,6 +8,7 @@ from .models import StockItem, StockLocation
from .models import StockItemTracking
from part.serializers import PartBriefSerializer
+from company.serializers import SupplierPartSerializer
from InvenTree.serializers import UserSerializerBrief, InvenTreeModelSerializer
@@ -61,13 +62,17 @@ class StockItemSerializer(InvenTreeModelSerializer):
part_image = serializers.CharField(source='part__image', read_only=True)
+ tracking_items = serializers.IntegerField(source='tracking_info_count', read_only=True)
+
part_detail = PartBriefSerializer(source='part', many=False, read_only=True)
location_detail = LocationBriefSerializer(source='location', many=False, read_only=True)
+ supplier_detail = SupplierPartSerializer(source='supplier_part', many=False, read_only=True)
def __init__(self, *args, **kwargs):
part_detail = kwargs.pop('part_detail', False)
location_detail = kwargs.pop('location_detail', False)
+ supplier_detail = kwargs.pop('supplier_detail', False)
super(StockItemSerializer, self).__init__(*args, **kwargs)
@@ -77,6 +82,9 @@ class StockItemSerializer(InvenTreeModelSerializer):
if location_detail is not True:
self.fields.pop('location_detail')
+ if supplier_detail is not True:
+ self.fields.pop('supplier_detail')
+
class Meta:
model = StockItem
fields = [
@@ -94,8 +102,10 @@ class StockItemSerializer(InvenTreeModelSerializer):
'quantity',
'serial',
'supplier_part',
+ 'supplier_detail',
'status',
'status_text',
+ 'tracking_items',
'url',
]
diff --git a/InvenTree/templates/about.html b/InvenTree/templates/about.html
index 1a5533df36..494d248d5e 100644
--- a/InvenTree/templates/about.html
+++ b/InvenTree/templates/about.html
@@ -15,6 +15,7 @@
+
|
{% trans "Instance Name" %} |
diff --git a/InvenTree/templates/stats.html b/InvenTree/templates/stats.html
index 0f8a9e0542..2f894364e2 100644
--- a/InvenTree/templates/stats.html
+++ b/InvenTree/templates/stats.html
@@ -3,6 +3,7 @@
{% load i18n %}