diff --git a/InvenTree/company/api.py b/InvenTree/company/api.py index 548ac96016..731fd193fa 100644 --- a/InvenTree/company/api.py +++ b/InvenTree/company/api.py @@ -131,6 +131,13 @@ class SupplierPartList(generics.ListCreateAPIView): if part is not None: queryset = queryset.filter(part=part) + # Filter by 'active' status of the part? + active = params.get('active', None) + + if active is not None: + active = str2bool(active) + queryset = queryset.filter(part__active=active) + return queryset def get_serializer(self, *args, **kwargs): diff --git a/InvenTree/company/templates/company/detail_part.html b/InvenTree/company/templates/company/detail_part.html index d10da0b60c..5f212d839a 100644 --- a/InvenTree/company/templates/company/detail_part.html +++ b/InvenTree/company/templates/company/detail_part.html @@ -34,6 +34,9 @@ +
+ +
{% endif %} diff --git a/InvenTree/templates/js/company.js b/InvenTree/templates/js/company.js index f904c0f506..e000b9e491 100644 --- a/InvenTree/templates/js/company.js +++ b/InvenTree/templates/js/company.js @@ -122,6 +122,7 @@ function loadSupplierPartTable(table, url, options) { $(table).inventreeTable({ url: url, method: 'get', + original: params, queryParams: filters, name: 'supplierparts', groupBy: false, @@ -135,6 +136,7 @@ function loadSupplierPartTable(table, url, options) { sortable: true, field: 'part_detail.full_name', title: '{% trans "Part" %}', + switchable: false, formatter: function(value, row, index, field) { var url = `/part/${row.part}/`; diff --git a/InvenTree/templates/js/table_filters.js b/InvenTree/templates/js/table_filters.js index c05f01d37f..2c83006f76 100644 --- a/InvenTree/templates/js/table_filters.js +++ b/InvenTree/templates/js/table_filters.js @@ -189,6 +189,15 @@ function getAvailableTableFilters(tableKey) { }; } + if (tableKey == 'supplier-part') { + return { + active: { + type: 'bool', + title: '{% trans "Active parts" %}', + } + }; + } + // Filters for the "Parts" table if (tableKey == "parts") { return {