mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Display packaging info in stock table
This commit is contained in:
parent
556d6455e8
commit
644583f636
@ -198,6 +198,7 @@ class StockItemSerializer(InvenTreeModelSerializer):
|
||||
'location',
|
||||
'location_detail',
|
||||
'notes',
|
||||
'packaging',
|
||||
'part',
|
||||
'part_detail',
|
||||
'pk',
|
||||
|
@ -359,6 +359,29 @@ function loadStockTable(table, options) {
|
||||
else if (field == 'part_detail.description') {
|
||||
return row.part_detail.description;
|
||||
}
|
||||
else if (field == 'packaging') {
|
||||
var packaging = [];
|
||||
|
||||
data.forEach(function(item) {
|
||||
var pkg = String(item.packaging);
|
||||
|
||||
if (!pkg || pkg == '') {
|
||||
pkg = '-';
|
||||
}
|
||||
|
||||
if (!packaging.includes(pkg)) {
|
||||
packaging.push(pkg);
|
||||
}
|
||||
});
|
||||
|
||||
if (packaging.length > 1) {
|
||||
return "...";
|
||||
} else if (packaging.length == 1) {
|
||||
return packaging[0];
|
||||
} else {
|
||||
return "-";
|
||||
}
|
||||
}
|
||||
else if (field == 'quantity') {
|
||||
var stock = 0;
|
||||
var items = 0;
|
||||
@ -388,7 +411,7 @@ function loadStockTable(table, options) {
|
||||
|
||||
// Multiple status codes
|
||||
if (statii.length > 1) {
|
||||
return "-";
|
||||
return "...";
|
||||
} else if (statii.length == 1) {
|
||||
return stockStatusDisplay(statii[0]);
|
||||
} else {
|
||||
@ -619,6 +642,12 @@ function loadStockTable(table, options) {
|
||||
title: '{% trans "Last Updated" %}',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
field: 'packaging',
|
||||
title: '{% trans "Packaging" %}',
|
||||
sortable: true,
|
||||
searchable: true,
|
||||
},
|
||||
{
|
||||
field: 'notes',
|
||||
title: '{% trans "Notes" %}',
|
||||
|
Loading…
Reference in New Issue
Block a user