mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
BOM table formatting
- Display link to external BOM - Prevent item from being edited to selected
This commit is contained in:
parent
43eba3f7ec
commit
5b402b6bc0
@ -137,6 +137,16 @@ function loadBomTable(table, options) {
|
|||||||
checkbox: true,
|
checkbox: true,
|
||||||
visible: true,
|
visible: true,
|
||||||
switchable: false,
|
switchable: false,
|
||||||
|
formatter: function(value, row, index, field) {
|
||||||
|
// Disable checkbox if the row is defined for a *different* part!
|
||||||
|
if (row.part != options.parent_id) {
|
||||||
|
return {
|
||||||
|
disabled: true,
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,6 +274,20 @@ function loadBomTable(table, options) {
|
|||||||
field: 'inherited',
|
field: 'inherited',
|
||||||
title: '{% trans "Inherited" %}',
|
title: '{% trans "Inherited" %}',
|
||||||
searchable: false,
|
searchable: false,
|
||||||
|
formatter: function(value, row, index, field) {
|
||||||
|
// This BOM item *is* inheritable, but is defined for this BOM
|
||||||
|
if (!row.inherited) {
|
||||||
|
return "-";
|
||||||
|
} else if (row.part == options.parent_id) {
|
||||||
|
return '{% trans "Inheritable" %}';
|
||||||
|
} else {
|
||||||
|
// If this BOM item is inherited from a parent part
|
||||||
|
return renderLink(
|
||||||
|
'{% trans "View BOM" %}',
|
||||||
|
`/part/${row.part}/bom/`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
cols.push(
|
cols.push(
|
||||||
@ -342,7 +366,12 @@ function loadBomTable(table, options) {
|
|||||||
|
|
||||||
return html;
|
return html;
|
||||||
} else {
|
} else {
|
||||||
return '';
|
// Return a link to the external BOM
|
||||||
|
|
||||||
|
return renderLink(
|
||||||
|
'{% trans "View BOM" %}',
|
||||||
|
`/part/${row.part}/bom/`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user