mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Fix filtering by 'validated' parameter
This commit is contained in:
parent
c04ea3e0bb
commit
568e606d5b
@ -1096,11 +1096,17 @@ class BomFilter(rest_filters.FilterSet):
|
|||||||
# Work out which lines have actually been validated
|
# Work out which lines have actually been validated
|
||||||
pks = []
|
pks = []
|
||||||
|
|
||||||
|
value = str2bool(value)
|
||||||
|
|
||||||
|
# Shortcut for quicker filtering - BomItem with empty 'checksum' values are not validated
|
||||||
|
if value:
|
||||||
|
queryset = queryset.exclude(checksum=None).exclude(checksum='')
|
||||||
|
|
||||||
for bom_item in queryset.all():
|
for bom_item in queryset.all():
|
||||||
if bom_item.is_line_valid():
|
if bom_item.is_line_valid:
|
||||||
pks.append(bom_item.pk)
|
pks.append(bom_item.pk)
|
||||||
|
|
||||||
if str2bool(value):
|
if value:
|
||||||
queryset = queryset.filter(pk__in=pks)
|
queryset = queryset.filter(pk__in=pks)
|
||||||
else:
|
else:
|
||||||
queryset = queryset.exclude(pk__in=pks)
|
queryset = queryset.exclude(pk__in=pks)
|
||||||
|
Loading…
Reference in New Issue
Block a user