mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #678 from SchrodingersGat/on-order
Add "On Order" badge
This commit is contained in:
commit
864a21ac85
@ -182,17 +182,27 @@ function loadPartTable(table, url, options={}) {
|
|||||||
searchable: false,
|
searchable: false,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
formatter: function(value, row, index, field) {
|
formatter: function(value, row, index, field) {
|
||||||
|
console.log("On order:", row.on_order);
|
||||||
|
|
||||||
|
var html = "";
|
||||||
|
var link = "stock";
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
|
|
||||||
if (row.units) {
|
if (row.units) {
|
||||||
value += ' <i><small>' + row.units + '</small></i>';
|
value += ' <i><small>' + row.units + '</small></i>';
|
||||||
}
|
}
|
||||||
|
|
||||||
return renderLink(value, '/part/' + row.pk + '/stock/');
|
html = value;
|
||||||
}
|
|
||||||
else {
|
} else if (row.on_order) {
|
||||||
return "<span class='label label-warning'>No Stock</span>";
|
value = "<span class='label label-primary'>On Order : " + row.on_order + "</span>";
|
||||||
|
link = "orders";
|
||||||
|
} else {
|
||||||
|
value ="<span class='label label-warning'>No Stock</span>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return renderLink(value, '/part/' + row.pk + "/" + link + "/");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -172,6 +172,7 @@ class PartList(generics.ListCreateAPIView):
|
|||||||
'active',
|
'active',
|
||||||
).annotate(
|
).annotate(
|
||||||
in_stock=Sum('stock_items__quantity'),
|
in_stock=Sum('stock_items__quantity'),
|
||||||
|
on_order=Sum('supplier_parts__purchase_order_line_items__quantity'),
|
||||||
)
|
)
|
||||||
|
|
||||||
# TODO - Annotate total being built
|
# TODO - Annotate total being built
|
||||||
|
Loading…
Reference in New Issue
Block a user