diff --git a/InvenTree/InvenTree/static/script/inventree/part.js b/InvenTree/InvenTree/static/script/inventree/part.js
index 8ad934760b..c94c512d6f 100644
--- a/InvenTree/InvenTree/static/script/inventree/part.js
+++ b/InvenTree/InvenTree/static/script/inventree/part.js
@@ -182,17 +182,27 @@ function loadPartTable(table, url, options={}) {
searchable: false,
sortable: true,
formatter: function(value, row, index, field) {
+ console.log("On order:", row.on_order);
+
+ var html = "";
+ var link = "stock";
+
if (value) {
if (row.units) {
value += ' ' + row.units + '';
}
- return renderLink(value, '/part/' + row.pk + '/stock/');
- }
- else {
- return "No Stock";
+ html = value;
+
+ } else if (row.on_order) {
+ value = "On Order : " + row.on_order + "";
+ link = "orders";
+ } else {
+ value ="No Stock";
}
+
+ return renderLink(value, '/part/' + row.pk + "/" + link + "/");
}
});
diff --git a/InvenTree/part/api.py b/InvenTree/part/api.py
index a121553409..d24f0dc6ee 100644
--- a/InvenTree/part/api.py
+++ b/InvenTree/part/api.py
@@ -172,6 +172,7 @@ class PartList(generics.ListCreateAPIView):
'active',
).annotate(
in_stock=Sum('stock_items__quantity'),
+ on_order=Sum('supplier_parts__purchase_order_line_items__quantity'),
)
# TODO - Annotate total being built