diff --git a/InvenTree/order/api.py b/InvenTree/order/api.py
index 96b886e15c..b2e7145d52 100644
--- a/InvenTree/order/api.py
+++ b/InvenTree/order/api.py
@@ -846,6 +846,12 @@ class SOAllocationList(generics.ListAPIView):
if order is not None:
queryset = queryset.filter(line__order=order)
+ # Filter by "stock item"
+ item = params.get('item', params.get('stock_item', None))
+
+ if item is not None:
+ queryset = queryset.filter(item=item)
+
# Filter by "outstanding" order status
outstanding = params.get('outstanding', None)
@@ -865,7 +871,6 @@ class SOAllocationList(generics.ListAPIView):
# Default filterable fields
filter_fields = [
- 'item',
]
diff --git a/InvenTree/stock/templates/stock/item.html b/InvenTree/stock/templates/stock/item.html
index 9cc6d85aeb..5c3f94f72f 100644
--- a/InvenTree/stock/templates/stock/item.html
+++ b/InvenTree/stock/templates/stock/item.html
@@ -43,9 +43,26 @@
+
+
+
{% trans "Stock Item Allocations" %}
+ {% include "spacer.html" %}
+
+
+
+
+
{% trans "Child Stock Items" %}
+ {% include "spacer.html" %}
{% if item.child_count > 0 %}
@@ -151,6 +168,19 @@
{% block js_ready %}
{{ block.super }}
+ // Load the "allocations" tab
+ onPanelLoad('allocations', function() {
+
+ loadStockAllocationTable(
+ $("#stock-allocation-table"),
+ {
+ params: {
+ stock_item: {{ item.pk }},
+ },
+ }
+ );
+ });
+
$('#stock-item-install').click(function() {
launchModalForm(
diff --git a/InvenTree/stock/templates/stock/stock_sidebar.html b/InvenTree/stock/templates/stock/stock_sidebar.html
index 8161251ad7..3032bab5bf 100644
--- a/InvenTree/stock/templates/stock/stock_sidebar.html
+++ b/InvenTree/stock/templates/stock/stock_sidebar.html
@@ -4,6 +4,10 @@
{% trans "Stock Tracking" as text %}
{% include "sidebar_item.html" with label='history' text=text icon="fa-history" %}
+{% if item.part.salable or item.part.component %}
+{% trans "Allocations" as text %}
+{% include "sidebar_item.html" with label="allocations" text=text icon="fa-bookmark" %}
+{% endif %}
{% if item.part.trackable %}
{% trans "Test Data" as text %}
{% include "sidebar_item.html" with label='test-data' text=text icon="fa-vial" %}
diff --git a/InvenTree/templates/js/translated/stock.js b/InvenTree/templates/js/translated/stock.js
index d37bb25e26..d9fee44297 100644
--- a/InvenTree/templates/js/translated/stock.js
+++ b/InvenTree/templates/js/translated/stock.js
@@ -2308,9 +2308,14 @@ function loadStockAllocationTable(table, options={}) {
title: '{% trans "Allocated Quantity" %}',
formatter: function(value, row) {
var text = value;
- var url = `/stock/item/${row.stock_item}/`;
+ var pk = row.stock_item || row.item;
- return renderLink(text, url);
+ if (pk) {
+ var url = `/stock/item/${pk}/`;
+ return renderLink(text, url);
+ } else {
+ return value;
+ }
}
},
]