diff --git a/InvenTree/templates/js/translated/bom.js b/InvenTree/templates/js/translated/bom.js index 93e1562a38..6de3cd2d15 100644 --- a/InvenTree/templates/js/translated/bom.js +++ b/InvenTree/templates/js/translated/bom.js @@ -798,17 +798,26 @@ function loadBomTable(table, options={}) { }); cols.push({ - field: 'sub_part_detail.stock', + field: 'available_stock', title: '{% trans "Available" %}', searchable: false, sortable: true, formatter: function(value, row) { var url = `/part/${row.sub_part_detail.pk}/?display=part-stock`; - var text = value; - if (value == null || value <= 0) { - text = `{% trans "No Stock" %}`; + // Calculate total "available" (unallocated) quantity + var total = row.available_stock + row.available_substitute_stock; + // var text = row.available_substitute_stock + row.available_stock; + + if (total <= 0) { + text = `{% trans "No Stock Available" %}`; + } else { + text = `${total}`; + + if (row.available_substitute_stock > 0) { + text += ``; + } } return renderLink(text, url);