Show BomItem reference field in BOM table

This commit is contained in:
Oliver Walters 2019-06-27 23:57:21 +10:00
parent 4648db6ce5
commit 808d332bda
3 changed files with 30 additions and 22 deletions

View File

@ -136,6 +136,7 @@ class EditBomItemForm(HelperForm):
'part',
'sub_part',
'quantity',
'reference',
'overage',
'note'
]

View File

@ -166,6 +166,7 @@ class BomItemSerializer(InvenTreeModelSerializer):
'sub_part',
'sub_part_detail',
'quantity',
'reference',
'price_range',
'overage',
'note',

View File

@ -63,33 +63,39 @@ function loadBomTable(table, options) {
}
);
// Part reference
cols.push({
field: 'reference',
title: 'Reference',
searchable: true,
sortable: true,
});
// Part quantity
cols.push(
{
field: 'quantity',
title: 'Required',
searchable: false,
sortable: true,
formatter: function(value, row, index, field) {
var text = value;
cols.push({
field: 'quantity',
title: 'Quantity',
searchable: false,
sortable: true,
formatter: function(value, row, index, field) {
var text = value;
if (row.overage) {
text += "<small> (+" + row.overage + ") </small>";
}
if (row.overage) {
text += "<small> (+" + row.overage + ") </small>";
}
return text;
},
footerFormatter: function(data) {
var quantity = 0;
return text;
},
footerFormatter: function(data) {
var quantity = 0;
data.forEach(function(item) {
quantity += item.quantity;
});
data.forEach(function(item) {
quantity += item.quantity;
});
return quantity;
},
}
);
return quantity;
},
});
if (!options.editable) {
cols.push(