mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Update javascript rendering in BOM table
This commit is contained in:
parent
fa2510c42f
commit
ec34d23bfc
@ -807,22 +807,23 @@ function loadBomTable(table, options={}) {
|
||||
var url = `/part/${row.sub_part_detail.pk}/?display=part-stock`;
|
||||
|
||||
// Calculate total "available" (unallocated) quantity
|
||||
var total = row.available_stock;
|
||||
var base_stock = row.available_stock;
|
||||
var substitute_stock = row.available_substitute_stock || 0;
|
||||
var variant_stock = row.allow_variants ? (row.available_variant_stock || 0) : 0;
|
||||
|
||||
var available_stock = base_stock + substitute_stock + variant_stock;
|
||||
|
||||
total += (row.available_substitute_stock || 0);
|
||||
total += (row.available_variant_stock || 0);
|
||||
var text = `${available_stock}`;
|
||||
|
||||
var text = `${total}`;
|
||||
|
||||
if (total <= 0) {
|
||||
if (available_stock <= 0) {
|
||||
text = `<span class='badge rounded-pill bg-danger'>{% trans "No Stock Available" %}</span>`;
|
||||
} else {
|
||||
var extra = '';
|
||||
if (row.available_substitute_stock && row.available_variant_stock) {
|
||||
if ((substitute_stock > 0) && (variant_stock > 0)) {
|
||||
extra = '{% trans "Includes variant and substitute stock" %}';
|
||||
} else if (row.available_variant_stock) {
|
||||
} else if (variant_stock > 0) {
|
||||
extra = '{% trans "Includes variant stock" %}';
|
||||
} else if (row.available_substitute_stock) {
|
||||
} else if (substitute_stock > 0) {
|
||||
extra = '{% trans "Includes substitute stock" %}';
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user