mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 20:16:44 +00:00
Adds ability to filter stockitem list by "has_batch" parmeter
This commit is contained in:
parent
5f455a6ee8
commit
33401cb207
@ -12,11 +12,14 @@ import common.models
|
|||||||
INVENTREE_SW_VERSION = "0.7.0 dev"
|
INVENTREE_SW_VERSION = "0.7.0 dev"
|
||||||
|
|
||||||
# InvenTree API version
|
# InvenTree API version
|
||||||
INVENTREE_API_VERSION = 38
|
INVENTREE_API_VERSION = 39
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Increment this API version number whenever there is a significant change to the API that any clients need to know about
|
Increment this API version number whenever there is a significant change to the API that any clients need to know about
|
||||||
|
|
||||||
|
v39 -> 2022-04-18
|
||||||
|
- Adds ability to filter StockItem list by "has_batch" parameter
|
||||||
|
|
||||||
v38 -> 2022-04-14 : https://github.com/inventree/InvenTree/pull/2828
|
v38 -> 2022-04-14 : https://github.com/inventree/InvenTree/pull/2828
|
||||||
- Adds the ability to include stock test results for "installed items"
|
- Adds the ability to include stock test results for "installed items"
|
||||||
|
|
||||||
|
@ -410,6 +410,20 @@ class StockFilter(rest_filters.FilterSet):
|
|||||||
|
|
||||||
return queryset
|
return queryset
|
||||||
|
|
||||||
|
has_batch = rest_filters.BooleanFilter(label='Has batch code', method='filter_has_batch')
|
||||||
|
|
||||||
|
def filter_has_batch(self, queryset, name, value):
|
||||||
|
"""
|
||||||
|
Filter by whether the StockItem has a batch code (or not)
|
||||||
|
"""
|
||||||
|
|
||||||
|
if str2bool(value):
|
||||||
|
queryset = queryset.exclude(batch=None)
|
||||||
|
else:
|
||||||
|
queryset = queryset.filter(batch=None)
|
||||||
|
|
||||||
|
return queryset
|
||||||
|
|
||||||
installed = rest_filters.BooleanFilter(label='Installed in other stock item', method='filter_installed')
|
installed = rest_filters.BooleanFilter(label='Installed in other stock item', method='filter_installed')
|
||||||
|
|
||||||
def filter_installed(self, queryset, name, value):
|
def filter_installed(self, queryset, name, value):
|
||||||
|
@ -234,6 +234,10 @@ function getAvailableTableFilters(tableKey) {
|
|||||||
title: '{% trans "Stock status" %}',
|
title: '{% trans "Stock status" %}',
|
||||||
description: '{% trans "Stock status" %}',
|
description: '{% trans "Stock status" %}',
|
||||||
},
|
},
|
||||||
|
has_batch: {
|
||||||
|
title: '{% trans "Has batch code" %}',
|
||||||
|
type: 'bool',
|
||||||
|
},
|
||||||
batch: {
|
batch: {
|
||||||
title: '{% trans "Batch" %}',
|
title: '{% trans "Batch" %}',
|
||||||
description: '{% trans "Batch code" %}',
|
description: '{% trans "Batch code" %}',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user