Add ability to filter by whether the part is serialized or not

This commit is contained in:
Oliver Walters 2020-05-12 20:18:28 +10:00
parent 4615fbc0d8
commit 0851a925fb

View File

@ -479,6 +479,17 @@ class StockList(generics.ListCreateAPIView):
if sales_order:
queryset = queryset.filter(sales_order=sales_order)
# Filter by "serialized" status?
serialized = params.get('serialized', None)
if serialized is not None:
serialized = str2bool(serialized)
if serialized:
queryset = queryset.exclude(serial=None)
else:
queryset = queryset.filter(serial=None)
# Filter by serial number?
serial_number = params.get('serial', None)