diff --git a/InvenTree/part/serializers.py b/InvenTree/part/serializers.py index 061bf06145..5746c00fdd 100644 --- a/InvenTree/part/serializers.py +++ b/InvenTree/part/serializers.py @@ -32,6 +32,7 @@ class PartBriefSerializer(serializers.ModelSerializer): 'url', 'name', 'description', + 'available_stock', ] diff --git a/InvenTree/part/templates/part/bom.html b/InvenTree/part/templates/part/bom.html index 723e0cad00..7b9e829686 100644 --- a/InvenTree/part/templates/part/bom.html +++ b/InvenTree/part/templates/part/bom.html @@ -85,10 +85,29 @@ }, { field: 'quantity', - title: 'Quantity', + title: 'Required', searchable: false, sortable: true }, + { + field: 'sub_part.available_stock', + title: 'Available', + searchable: false, + sortable: true, + formatter: function(value, row, index, field) { + var text = ""; + if (row.quantity < row.sub_part.available_stock) + { + text = "" + value + ""; + } + else + { + text = "" + value + ""; + } + + return renderLink(text, row.sub_part.url + "stock/"); + } + }, { formatter: function(value, row, index, field) { return editButton(row.url + 'edit') + ' ' + deleteButton(row.url + 'delete');