From fa60bc69bcde429dba4fc560556b987b30bc565b Mon Sep 17 00:00:00 2001 From: behruz-dev Date: Mon, 29 Sep 2025 17:54:42 +0500 Subject: [PATCH] add: add filter for inventory list --- core/apps/wherehouse/views/inventory.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/apps/wherehouse/views/inventory.py b/core/apps/wherehouse/views/inventory.py index 4e59a17..51dba94 100644 --- a/core/apps/wherehouse/views/inventory.py +++ b/core/apps/wherehouse/views/inventory.py @@ -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)