diff --git a/InvenTree/InvenTree/static/script/inventree/bom.js b/InvenTree/InvenTree/static/script/inventree/bom.js index 1b74088abf..3d1e8fc594 100644 --- a/InvenTree/InvenTree/static/script/inventree/bom.js +++ b/InvenTree/InvenTree/static/script/inventree/bom.js @@ -133,11 +133,11 @@ function loadBomTable(table, options) { title: 'Part', sortable: true, formatter: function(value, row, index, field) { - var html = imageHoverIcon(row.sub_part_detail.image_url) + renderLink(row.sub_part_detail.full_name, row.sub_part_detail.url); + var html = imageHoverIcon(row.sub_part_detail.thumbnail) + renderLink(row.sub_part_detail.full_name, row.sub_part_detail.url); // Display an extra icon if this part is an assembly if (row.sub_part_detail.assembly) { - html += ""; + html += ""; } return html; diff --git a/InvenTree/part/api.py b/InvenTree/part/api.py index c9e38ea74b..7d193fa1ee 100644 --- a/InvenTree/part/api.py +++ b/InvenTree/part/api.py @@ -485,6 +485,19 @@ class BomList(generics.ListCreateAPIView): def get_queryset(self): queryset = BomItem.objects.all() queryset = self.get_serializer_class().setup_eager_loading(queryset) + + # Filter by part? + part = self.request.query_params.get('part', None) + + if part is not None: + queryset = queryset.filter(part=part) + + # Filter by sub-part? + sub_part = self.request.query_params.get('sub_part', None) + + if sub_part is not None: + queryset = queryset.filter(sub_part=sub_part) + return queryset permission_classes = [ @@ -498,8 +511,6 @@ class BomList(generics.ListCreateAPIView): ] filter_fields = [ - 'part', - 'sub_part', ] diff --git a/InvenTree/part/templates/part/tabs.html b/InvenTree/part/templates/part/tabs.html index 717918e542..b0cf14be5d 100644 --- a/InvenTree/part/templates/part/tabs.html +++ b/InvenTree/part/templates/part/tabs.html @@ -25,7 +25,7 @@ {% trans "BOM" %}{{ part.bom_count }} - {% trans "Build" %}{{ part.active_builds|length }} + {% trans "Build" %}{{ part.builds|length }} {% endif %} {% if part.component or part.used_in_count > 0 %} diff --git a/InvenTree/part/templates/part/used_in.html b/InvenTree/part/templates/part/used_in.html index bad93b17ec..1d3589a0d3 100644 --- a/InvenTree/part/templates/part/used_in.html +++ b/InvenTree/part/templates/part/used_in.html @@ -35,7 +35,7 @@ title: 'Part', sortable: true, formatter: function(value, row, index, field) { - var html = imageHoverIcon(row.part_detail.image_url) + renderLink(value.full_name, value.url + 'bom/'); + var html = imageHoverIcon(row.part_detail.thumbnail) + renderLink(value.full_name, value.url + 'bom/'); if (!row.part_detail.active) { html += "INACTIVE";