Add stock filter for parts assemblies

This commit is contained in:
eeintech 2021-03-12 11:18:19 -05:00
parent ed028aed62
commit 89c7c87f1e
2 changed files with 14 additions and 1 deletions

View File

@ -665,6 +665,14 @@ 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:
print('ASSEMBLY')
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',