diff --git a/InvenTree/stock/api.py b/InvenTree/stock/api.py index 54cb5a62cf..900a94ed52 100644 --- a/InvenTree/stock/api.py +++ b/InvenTree/stock/api.py @@ -455,6 +455,12 @@ class StockList(generics.ListCreateAPIView): if belongs_to: queryset = queryset.filter(belongs_to=belongs_to) + # Filter by batch code + batch = params.get('batch', None) + + if batch is not None: + queryset = queryset.filter(batch=batch) + build = params.get('build', None) if build: diff --git a/InvenTree/templates/js/table_filters.html b/InvenTree/templates/js/table_filters.html index bd417882e3..316abcad7b 100644 --- a/InvenTree/templates/js/table_filters.html +++ b/InvenTree/templates/js/table_filters.html @@ -30,6 +30,10 @@ function getAvailableTableFilters(tableKey) { title: "{% trans "Serial number" %}", description: "{% trans "Serial number" %}" }, + batch: { + title: '{% trans "Batch" %}', + description: '{% trans "Batch code" %}', + }, }; } @@ -87,6 +91,10 @@ function getAvailableTableFilters(tableKey) { title: '{% trans "Stock status" %}', description: '{% trans "Stock status" %}', }, + batch: { + title: '{% trans "Batch" %}', + description: '{% trans "Batch code" %}', + } }; }