add: add filter for inventory list
This commit is contained in:
@@ -25,7 +25,7 @@ class InventoryListApiView(generics.GenericAPIView):
|
||||
project_ids = request.query_params.getlist('project_ids')
|
||||
product_exists = request.query_params.get('product_exist')
|
||||
start_date = request.query_params.get('start_date')
|
||||
start_date = request.query_params.get('end_date')
|
||||
end_date = request.query_params.get('end_date')
|
||||
inventories = self.filter_queryset(self.queryset)
|
||||
|
||||
if wherehouse_ids:
|
||||
@@ -38,6 +38,8 @@ class InventoryListApiView(generics.GenericAPIView):
|
||||
inventories = inventories.exclude(quantity=0)
|
||||
elif product_exists == 'false':
|
||||
inventories = inventories.filter(quantity=0)
|
||||
if start_date and end_date:
|
||||
inventories = inventories.filter(created_at__range=(start_date, end_date))
|
||||
page = self.paginate_queryset(inventories)
|
||||
if page is not None:
|
||||
serializer = self.serializer_class(page, many=True)
|
||||
|
||||
Reference in New Issue
Block a user