mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 12:06:44 +00:00
Include variant stock in part table (#3573)
This commit is contained in:
parent
efafa3960b
commit
868697392f
@ -1463,18 +1463,24 @@ function loadPartTable(table, url, options={}) {
|
|||||||
|
|
||||||
var text = '';
|
var text = '';
|
||||||
|
|
||||||
|
var total_stock = row.in_stock;
|
||||||
|
|
||||||
|
if (row.variant_stock) {
|
||||||
|
total_stock += row.variant_stock;
|
||||||
|
}
|
||||||
|
|
||||||
if (row.unallocated_stock != row.in_stock) {
|
if (row.unallocated_stock != row.in_stock) {
|
||||||
text = `${row.unallocated_stock} / ${row.in_stock}`;
|
text = `${row.unallocated_stock} / ${total_stock}`;
|
||||||
} else {
|
} else {
|
||||||
text = `${row.in_stock}`;
|
text = `${total_stock}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Construct extra informational badges
|
// Construct extra informational badges
|
||||||
var badges = '';
|
var badges = '';
|
||||||
|
|
||||||
if (row.in_stock == 0) {
|
if (total_stock == 0) {
|
||||||
badges += `<span class='fas fa-exclamation-circle icon-red float-right' title='{% trans "No stock" %}'></span>`;
|
badges += `<span class='fas fa-exclamation-circle icon-red float-right' title='{% trans "No stock" %}'></span>`;
|
||||||
} else if (row.in_stock < row.minimum_stock) {
|
} else if (total_stock < row.minimum_stock) {
|
||||||
badges += `<span class='fas fa-exclamation-circle icon-yellow float-right' title='{% trans "Low stock" %}'></span>`;
|
badges += `<span class='fas fa-exclamation-circle icon-yellow float-right' title='{% trans "Low stock" %}'></span>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1492,6 +1498,10 @@ function loadPartTable(table, url, options={}) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (row.variant_stock && row.variant_stock > 0) {
|
||||||
|
badges += `<span class='fas fa-info-circle float-right' title='{% trans "Includes variant stock" %}'></span>`;
|
||||||
|
}
|
||||||
|
|
||||||
text = renderLink(text, `/part/${row.pk}/?display=part-stock`);
|
text = renderLink(text, `/part/${row.pk}/?display=part-stock`);
|
||||||
text += badges;
|
text += badges;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user