From 083bfe05c0b11e120f21fea3d19f592295fc9757 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 19 Sep 2020 21:49:07 +1000 Subject: [PATCH] Add ability to search stock API - serial number - part information --- InvenTree/stock/api.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/InvenTree/stock/api.py b/InvenTree/stock/api.py index 7741c67129..ad2c46e8f3 100644 --- a/InvenTree/stock/api.py +++ b/InvenTree/stock/api.py @@ -440,6 +440,8 @@ class StockList(generics.ListCreateAPIView): params = self.request.query_params + queryset = super().filter_queryset(queryset) + # Perform basic filtering: # Note: We do not let DRF filter here, it be slow AF @@ -680,6 +682,13 @@ class StockList(generics.ListCreateAPIView): filter_fields = [ ] + search_fields = [ + 'serial', + 'part__name', + 'part__IPN', + 'part__description' + ] + class StockAttachmentList(generics.ListCreateAPIView, AttachmentMixin): """