From 3f03adba724cd683ba101020fa123fb527bd612c Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Tue, 3 Nov 2020 15:05:13 +1100 Subject: [PATCH] Bug fix for stock table - Grouped rows were not displaying the part name --- InvenTree/build/api.py | 10 ++++++---- InvenTree/config_template.yaml | 11 ++++++----- InvenTree/templates/js/build.js | 2 +- InvenTree/templates/js/stock.js | 13 ++++++++++--- InvenTree/templates/js/table_filters.js | 4 ++-- 5 files changed, 25 insertions(+), 15 deletions(-) diff --git a/InvenTree/build/api.py b/InvenTree/build/api.py index 7748a90f63..2401e9d936 100644 --- a/InvenTree/build/api.py +++ b/InvenTree/build/api.py @@ -52,14 +52,16 @@ class BuildList(generics.ListCreateAPIView): queryset = super().filter_queryset(queryset) + params = self.request.query_params + # Filter by build status? - status = self.request.query_params.get('status', None) + status = params.get('status', None) if status is not None: queryset = queryset.filter(status=status) - # Filter by "active" status - active = self.request.query_params.get('active', None) + # Filter by "pending" status + active = params.get('active', None) if active is not None: active = str2bool(active) @@ -70,7 +72,7 @@ class BuildList(generics.ListCreateAPIView): queryset = queryset.exclude(status__in=BuildStatus.ACTIVE_CODES) # Filter by associated part? - part = self.request.query_params.get('part', None) + part = params.get('part', None) if part is not None: queryset = queryset.filter(part=part) diff --git a/InvenTree/config_template.yaml b/InvenTree/config_template.yaml index 94ec36bec7..ecd0a241cf 100644 --- a/InvenTree/config_template.yaml +++ b/InvenTree/config_template.yaml @@ -29,6 +29,12 @@ timezone: UTC # Set debug to False to run in production mode debug: True +# Set debug_toolbar to True to enable a debugging toolbar for InvenTree +# Note: This will only be displayed if DEBUG mode is enabled, +# and only if InvenTree is accessed from a local IP (127.0.0.1) +debug_toolbar: False + + # Allowed hosts (see ALLOWED_HOSTS in Django settings documentation) # A list of strings representing the host/domain names that this Django site can serve. # Default behaviour is to allow all hosts (THIS IS NOT SECURE!) @@ -63,11 +69,6 @@ static_root: '../inventree_static' # - git # - ssh -# Set debug_toolbar to True to enable a debugging toolbar for InvenTree -# Note: This will only be displayed if DEBUG mode is enabled, -# and only if InvenTree is accessed from a local IP (127.0.0.1) -debug_toolbar: False - # Backup options # Set the backup_dir parameter to store backup files in a specific location # If unspecified, the local user's temp directory will be used diff --git a/InvenTree/templates/js/build.js b/InvenTree/templates/js/build.js index 58839c5e1d..e2bc7846de 100644 --- a/InvenTree/templates/js/build.js +++ b/InvenTree/templates/js/build.js @@ -595,7 +595,7 @@ function loadBuildTable(table, options) { var filters = {}; if (!options.disableFilters) { - loadTableFilters("build"); + filters = loadTableFilters("build"); } for (var key in params) { diff --git a/InvenTree/templates/js/stock.js b/InvenTree/templates/js/stock.js index 9339cdeda7..e59bf5d469 100644 --- a/InvenTree/templates/js/stock.js +++ b/InvenTree/templates/js/stock.js @@ -324,11 +324,16 @@ function loadStockTable(table, options) { var row = data[0]; - if (field == 'part_detail.name') { + if (field == 'part_detail.full_name') { - var name = row.part_detail.full_name; + var html = imageHoverIcon(row.part_detail.thumbnail); - return imageHoverIcon(row.part_detail.thumbnail) + name + ' (' + data.length + ' items)'; + html += row.part_detail.full_name; + html += ` (${data.length} items)`; + + html += makePartIcons(row.part_detail); + + return html; } else if (field == 'part_detail.IPN') { return row.part_detail.IPN; @@ -471,6 +476,8 @@ function loadStockTable(table, options) { html = imageHoverIcon(thumb) + renderLink(name, url); + html += makePartIcons(row.part_detail); + return html; } }, diff --git a/InvenTree/templates/js/table_filters.js b/InvenTree/templates/js/table_filters.js index 00a3639239..153411d4e9 100644 --- a/InvenTree/templates/js/table_filters.js +++ b/InvenTree/templates/js/table_filters.js @@ -181,9 +181,9 @@ function getAvailableTableFilters(tableKey) { title: '{% trans "Build status" %}', options: buildCodes, }, - pending: { + active: { type: 'bool', - title: '{% trans "Pending" %}', + title: '{% trans "Active" %}', } }; }