diff --git a/InvenTree/part/api.py b/InvenTree/part/api.py
index b2b70b3030..537b0f9e40 100644
--- a/InvenTree/part/api.py
+++ b/InvenTree/part/api.py
@@ -827,7 +827,7 @@ class BomList(generics.ListCreateAPIView):
if variants is not None:
variants = str2bool(variants)
- queryset = queryset.filter(allow_variants=variants)
+ queryset = queryset.filter(allow_variants=variants)
# Filter by part?
part = params.get('part', None)
diff --git a/InvenTree/part/forms.py b/InvenTree/part/forms.py
index 8f6e3d8898..95de4961f9 100644
--- a/InvenTree/part/forms.py
+++ b/InvenTree/part/forms.py
@@ -352,6 +352,7 @@ class EditBomItemForm(HelperForm):
'reference',
'overage',
'note',
+ 'allow_variants',
'inherited',
'optional',
]
diff --git a/InvenTree/templates/js/bom.js b/InvenTree/templates/js/bom.js
index e35a51d8bd..7328bcb331 100644
--- a/InvenTree/templates/js/bom.js
+++ b/InvenTree/templates/js/bom.js
@@ -285,11 +285,18 @@ function loadBomTable(table, options) {
title: '{% trans "Optional" %}',
searchable: false,
formatter: function(value) {
- if (value == '1') return '{% trans "true" %}';
- if (value == '0') return '{% trans "false" %}';
+ return yesNoLabel(value);
}
});
+ cols.push({
+ field: 'allow_variants',
+ title: '{% trans "Allow Variants" %}',
+ formatter: function(value) {
+ return yesNoLabel(value);
+ }
+ })
+
cols.push({
field: 'inherited',
title: '{% trans "Inherited" %}',
@@ -297,7 +304,7 @@ function loadBomTable(table, options) {
formatter: function(value, row, index, field) {
// This BOM item *is* inheritable, but is defined for this BOM
if (!row.inherited) {
- return "-";
+ return yesNoLabel(false);
} else if (row.part == options.parent_id) {
return '{% trans "Inherited" %}';
} else {
diff --git a/InvenTree/templates/js/part.js b/InvenTree/templates/js/part.js
index 81cc4e0630..7331ec25e0 100644
--- a/InvenTree/templates/js/part.js
+++ b/InvenTree/templates/js/part.js
@@ -5,6 +5,14 @@
* Requires api.js to be loaded first
*/
+function yesNoLabel(value) {
+ if (value) {
+ return `{% trans "YES" %}`;
+ } else {
+ return `{% trans "NO" %}`;
+ }
+}
+
function toggleStar(options) {
/* Toggle the 'starred' status of a part.
* Performs AJAX queries and updates the display on the button.
@@ -662,16 +670,6 @@ function loadPartCategoryTable(table, options) {
});
}
-
-function yesNoLabel(value) {
- if (value) {
- return `{% trans "YES" %}`;
- } else {
- return `{% trans "NO" %}`;
- }
-}
-
-
function loadPartTestTemplateTable(table, options) {
/*
* Load PartTestTemplate table.
diff --git a/InvenTree/templates/js/table_filters.js b/InvenTree/templates/js/table_filters.js
index 5f516e9419..d02fa50d80 100644
--- a/InvenTree/templates/js/table_filters.js
+++ b/InvenTree/templates/js/table_filters.js
@@ -49,6 +49,10 @@ function getAvailableTableFilters(tableKey) {
inherited: {
type: 'bool',
title: '{% trans "Inherited" %}',
+ },
+ allow_variants: {
+ type: 'bool',
+ title: '{% trans "Allow Variant Stock" %}',
}
};
}