Bug fix for stock table

- Grouped rows were not displaying the part name
This commit is contained in:
Oliver Walters 2020-11-03 15:05:13 +11:00
parent 05613b9642
commit 3f03adba72
5 changed files with 25 additions and 15 deletions

View File

@ -52,14 +52,16 @@ class BuildList(generics.ListCreateAPIView):
queryset = super().filter_queryset(queryset) queryset = super().filter_queryset(queryset)
params = self.request.query_params
# Filter by build status? # Filter by build status?
status = self.request.query_params.get('status', None) status = params.get('status', None)
if status is not None: if status is not None:
queryset = queryset.filter(status=status) queryset = queryset.filter(status=status)
# Filter by "active" status # Filter by "pending" status
active = self.request.query_params.get('active', None) active = params.get('active', None)
if active is not None: if active is not None:
active = str2bool(active) active = str2bool(active)
@ -70,7 +72,7 @@ class BuildList(generics.ListCreateAPIView):
queryset = queryset.exclude(status__in=BuildStatus.ACTIVE_CODES) queryset = queryset.exclude(status__in=BuildStatus.ACTIVE_CODES)
# Filter by associated part? # Filter by associated part?
part = self.request.query_params.get('part', None) part = params.get('part', None)
if part is not None: if part is not None:
queryset = queryset.filter(part=part) queryset = queryset.filter(part=part)

View File

@ -29,6 +29,12 @@ timezone: UTC
# Set debug to False to run in production mode # Set debug to False to run in production mode
debug: True 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) # Allowed hosts (see ALLOWED_HOSTS in Django settings documentation)
# A list of strings representing the host/domain names that this Django site can serve. # 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!) # Default behaviour is to allow all hosts (THIS IS NOT SECURE!)
@ -63,11 +69,6 @@ static_root: '../inventree_static'
# - git # - git
# - ssh # - 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 # Backup options
# Set the backup_dir parameter to store backup files in a specific location # Set the backup_dir parameter to store backup files in a specific location
# If unspecified, the local user's temp directory will be used # If unspecified, the local user's temp directory will be used

View File

@ -595,7 +595,7 @@ function loadBuildTable(table, options) {
var filters = {}; var filters = {};
if (!options.disableFilters) { if (!options.disableFilters) {
loadTableFilters("build"); filters = loadTableFilters("build");
} }
for (var key in params) { for (var key in params) {

View File

@ -324,11 +324,16 @@ function loadStockTable(table, options) {
var row = data[0]; 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 + ' <i>(' + data.length + ' items)</i>'; html += row.part_detail.full_name;
html += ` <i>(${data.length} items)</i>`;
html += makePartIcons(row.part_detail);
return html;
} }
else if (field == 'part_detail.IPN') { else if (field == 'part_detail.IPN') {
return row.part_detail.IPN; return row.part_detail.IPN;
@ -471,6 +476,8 @@ function loadStockTable(table, options) {
html = imageHoverIcon(thumb) + renderLink(name, url); html = imageHoverIcon(thumb) + renderLink(name, url);
html += makePartIcons(row.part_detail);
return html; return html;
} }
}, },

View File

@ -181,9 +181,9 @@ function getAvailableTableFilters(tableKey) {
title: '{% trans "Build status" %}', title: '{% trans "Build status" %}',
options: buildCodes, options: buildCodes,
}, },
pending: { active: {
type: 'bool', type: 'bool',
title: '{% trans "Pending" %}', title: '{% trans "Active" %}',
} }
}; };
} }