mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Display batch information in stock table
This commit is contained in:
parent
b3be5ca5a0
commit
910d9a15f6
@ -82,6 +82,32 @@ function loadStockTable(table, options) {
|
||||
});
|
||||
|
||||
return stock;
|
||||
} else if (field == 'batch') {
|
||||
var batches = [];
|
||||
|
||||
data.forEach(function(item) {
|
||||
var batch = item.batch;
|
||||
|
||||
if (!batch) {
|
||||
batch = '-';
|
||||
}
|
||||
|
||||
if (!batches.includes(item.batch)) {
|
||||
batches.push(item.batch);
|
||||
}
|
||||
});
|
||||
|
||||
if (batches.length > 1) {
|
||||
return "" + batches.length + " batches";
|
||||
} else if (batches.length == 1) {
|
||||
if (batches[0]) {
|
||||
return batches[0];
|
||||
} else {
|
||||
return '-';
|
||||
}
|
||||
} else {
|
||||
return '-';
|
||||
}
|
||||
} else if (field == 'location__path') {
|
||||
/* Determine how many locations */
|
||||
var locations = [];
|
||||
@ -165,6 +191,11 @@ function loadStockTable(table, options) {
|
||||
return text;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'batch',
|
||||
title: 'Batch',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
field: 'location__path',
|
||||
title: 'Location',
|
||||
|
Loading…
Reference in New Issue
Block a user