Merge pull request #1401 from eeintech/stock_filter_assembly

Stock filter for parts assemblies
This commit is contained in:
Oliver 2021-03-13 07:48:15 +11:00 committed by GitHub
commit 82faccc62f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -665,6 +665,13 @@ class StockList(generics.ListCreateAPIView):
active = str2bool(active)
queryset = queryset.filter(part__active=active)
# Do we wish to filter by "assembly parts"
assembly = params.get('assembly', None)
if assembly is not None:
assembly = str2bool(assembly)
queryset = queryset.filter(part__assembly=assembly)
# Filter by 'depleted' status
depleted = params.get('depleted', None)

View File

@ -96,10 +96,15 @@ function getAvailableTableFilters(tableKey) {
title: '{% trans "Active parts" %}',
description: '{% trans "Show stock for active parts" %}',
},
assembly: {
type: 'bool',
title: '{% trans "Assembly" %}',
description: '{% trans "Part is an assembly" %}',
},
allocated: {
type: 'bool',
title: '{% trans "Is allocated" %}',
description: '{% trans "Item has been alloacted" %}',
description: '{% trans "Item has been allocated" %}',
},
cascade: {
type: 'bool',