diff --git a/InvenTree/templates/js/translated/part.js b/InvenTree/templates/js/translated/part.js index 1c6bd56d90..1c66c32b6e 100644 --- a/InvenTree/templates/js/translated/part.js +++ b/InvenTree/templates/js/translated/part.js @@ -494,14 +494,40 @@ function duplicateBom(part_id, options={}) { function partStockLabel(part, options={}) { if (part.in_stock) { - if (part.unallocated_stock) { - return `{% trans "Available" %}: ${part.unallocated_stock}/${part.in_stock}`; + // There IS stock available for this part + + // Is stock "low" (below the 'minimum_stock' quantity)? + if (part.minimum_stock && part.minimum_stock > part.in_stock) { + return `{% trans "Low stock" %}: ${part.in_stock}${part.units}`; + } else if (part.unallocated_stock == 0) { + if (part.ordering) { + // There is no available stock, but stock is on order + return `{% trans "On Order" %}: ${part.ordering}${part.units}`; + } else if (part.building) { + // There is no available stock, but stock is being built + return `{% trans "Building" %}: ${part.building}${part.units}`; + } else { + // There is no available stock + return `{% trans "Available" %}: 0/${part.in_stock}${part.units}`; + } } else { - return `{% trans "Available" %}: ${part.unallocated_stock}/${part.in_stock}`; + return `{% trans "Available" %}: ${part.unallocated_stock}/${part.in_stock}${part.units}`; } } else { - return `{% trans "No Stock" %}`; + // There IS NO stock available for this part + + if (part.ordering) { + // There is no stock, but stock is on order + return `{% trans "On Order" %}: ${part.ordering}${part.units}`; + } else if (part.building) { + // There is no stock, but stock is being built + return `{% trans "Building" %}: ${part.building}${part.units}`; + } else { + // There is no stock + return `{% trans "No Stock" %}`; + } } + }