diff --git a/InvenTree/InvenTree/static/css/inventree.css b/InvenTree/InvenTree/static/css/inventree.css index 3725d79c7b..b4943a9b9a 100644 --- a/InvenTree/InvenTree/static/css/inventree.css +++ b/InvenTree/InvenTree/static/css/inventree.css @@ -112,6 +112,10 @@ font-size: 100%; } +.label-right { + float: right; +} + /* Bootstrap table overrides */ .stock-sub-group td { diff --git a/InvenTree/InvenTree/static/script/inventree/part.js b/InvenTree/InvenTree/static/script/inventree/part.js index 693a4d1faa..f05c5670da 100644 --- a/InvenTree/InvenTree/static/script/inventree/part.js +++ b/InvenTree/InvenTree/static/script/inventree/part.js @@ -182,25 +182,27 @@ function loadPartTable(table, url, options={}) { searchable: false, sortable: true, formatter: function(value, row, index, field) { - var html = ""; var link = "stock"; - + if (value) { + // There IS stock available for this part - if (row.units) { - value += ' ' + row.units + ''; + // Is stock "low" (below the 'minimum_stock' quantity)? + if (row.minimum_stock && row.minimum_stock > value) { + value += "Low stock"; } - html = value; - } else if (row.on_order) { - value = "On Order : " + row.on_order + ""; + // There is no stock available, but stock is on order + value = "0On Order : " + row.on_order + ""; link = "orders"; } else if (row.building) { - value = "Building : " + row.building + ""; + // There is no stock available, but stock is being built + value = "0Building : " + row.building + ""; link = "builds"; } else { - value ="No Stock"; + // There is no stock available + value = "0No Stock"; } return renderLink(value, '/part/' + row.pk + "/" + link + "/"); diff --git a/InvenTree/part/api.py b/InvenTree/part/api.py index 1d6aaa84aa..2a96a47fef 100644 --- a/InvenTree/part/api.py +++ b/InvenTree/part/api.py @@ -178,6 +178,7 @@ class PartList(generics.ListCreateAPIView): 'is_template', 'URL', 'units', + 'minimum_stock', 'trackable', 'assembly', 'component', diff --git a/InvenTree/part/templates/part/part_base.html b/InvenTree/part/templates/part/part_base.html index 27e5aedb83..7eb2f1dc5a 100644 --- a/InvenTree/part/templates/part/part_base.html +++ b/InvenTree/part/templates/part/part_base.html @@ -98,7 +98,7 @@