diff --git a/InvenTree/templates/js/translated/part.js b/InvenTree/templates/js/translated/part.js
index 1c66c32b6e..7a08d534df 100644
--- a/InvenTree/templates/js/translated/part.js
+++ b/InvenTree/templates/js/translated/part.js
@@ -491,13 +491,16 @@ function duplicateBom(part_id, options={}) {
}
+/*
+ * Construct a "badge" label showing stock information for this particular part
+ */
function partStockLabel(part, options={}) {
if (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) {
+ if ((part.minimum_stock > 0) && (part.minimum_stock > part.in_stock)) {
return `{% trans "Low stock" %}: ${part.in_stock}${part.units}`;
} else if (part.unallocated_stock == 0) {
if (part.ordering) {
@@ -507,11 +510,15 @@ function partStockLabel(part, options={}) {
// 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}`;
+ // There is no available stock at all
+ return `{% trans "No stock available" %}`;
}
- } else {
+ } else if (part.unallocated_stock < part.in_stock) {
+ // Unallocated quanttiy is less than total quantity
return `{% trans "Available" %}: ${part.unallocated_stock}/${part.in_stock}${part.units}`;
+ } else {
+ // Stock is completely available
+ return `{% trans "Available" %}: ${part.unallocated_stock}${part.units}`;
}
} else {
// There IS NO stock available for this part