Merge pull request #800 from SchrodingersGat/stock-api

Stock api
This commit is contained in:
Oliver 2020-05-12 20:26:30 +10:00 committed by GitHub
commit 2948dad831
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -478,6 +478,23 @@ 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)
if serial_number is not None:
queryset = queryset.filter(serial=serial_number)
in_stock = self.request.query_params.get('in_stock', None)