From f5a8b110b5811e0ad2b619e3be8671f0f2d347df Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 11 Apr 2020 23:02:18 +1000 Subject: [PATCH] Filter part table by 'is_component' status --- InvenTree/InvenTree/static/script/inventree/part.js | 6 ++++++ InvenTree/part/api.py | 1 + InvenTree/templates/table_filters.html | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/InvenTree/InvenTree/static/script/inventree/part.js b/InvenTree/InvenTree/static/script/inventree/part.js index 54947c949b..a03dd6d89a 100644 --- a/InvenTree/InvenTree/static/script/inventree/part.js +++ b/InvenTree/InvenTree/static/script/inventree/part.js @@ -146,6 +146,12 @@ function loadPartTable(table, url, options={}) { if (row.assembly) { display = display + ``; } + + /* + if (row.component) { + display = display + ``; + } + */ if (!row.active) { display = display + ``; diff --git a/InvenTree/part/api.py b/InvenTree/part/api.py index 5f6eed41ac..dd2b86e064 100644 --- a/InvenTree/part/api.py +++ b/InvenTree/part/api.py @@ -156,6 +156,7 @@ class PartList(generics.ListCreateAPIView): - is_template: Is the part a template part? - variant_of: Filter by variant_of Part reference - assembly: Filter by assembly field + - component: Filter by component field """ serializer_class = part_serializers.PartSerializer diff --git a/InvenTree/templates/table_filters.html b/InvenTree/templates/table_filters.html index 6e362ab3d4..0bff04a7aa 100644 --- a/InvenTree/templates/table_filters.html +++ b/InvenTree/templates/table_filters.html @@ -85,6 +85,10 @@ function getAvailableTableFilters(tableKey) { type: 'bool', title: '{% trans "Assembly" %}', }, + component: { + type: 'bool', + title: '{% trans "Component" %}', + }, }; }