2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-30 20:46:47 +00:00

Merge pull request #996 from SchrodingersGat/batch-filtering

Adds ability to filter stock API results by batch code
This commit is contained in:
Oliver 2020-09-23 09:20:13 +10:00 committed by GitHub
commit 3a5014da4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View File

@ -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:

View File

@ -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" %}',
}
};
}