mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-17 04:25:42 +00:00
Adds "is_variant" filter for Part API (#9077)
* Adds "is_variant" filter for Part API * Bump API version
This commit is contained in:
@ -1,13 +1,16 @@
|
|||||||
"""InvenTree API version information."""
|
"""InvenTree API version information."""
|
||||||
|
|
||||||
# InvenTree API version
|
# InvenTree API version
|
||||||
INVENTREE_API_VERSION = 309
|
INVENTREE_API_VERSION = 310
|
||||||
|
|
||||||
"""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."""
|
||||||
|
|
||||||
|
|
||||||
INVENTREE_API_TEXT = """
|
INVENTREE_API_TEXT = """
|
||||||
|
|
||||||
|
v310 - 2025-02-14 : https://github.com/inventree/InvenTree/pull/9077
|
||||||
|
- Adds 'is_variant' filter to the Part list API
|
||||||
|
|
||||||
v309 - 2025-02-02 : https://github.com/inventree/InvenTree/pull/9008
|
v309 - 2025-02-02 : https://github.com/inventree/InvenTree/pull/9008
|
||||||
- Bug fixes for the "Part" serializer
|
- Bug fixes for the "Part" serializer
|
||||||
- Fixes for data import API endpoints
|
- Fixes for data import API endpoints
|
||||||
|
@ -895,6 +895,14 @@ class PartFilter(rest_filters.FilterSet):
|
|||||||
model = Part
|
model = Part
|
||||||
fields = ['revision_of']
|
fields = ['revision_of']
|
||||||
|
|
||||||
|
is_variant = rest_filters.BooleanFilter(
|
||||||
|
label=_('Is Variant'), method='filter_is_variant'
|
||||||
|
)
|
||||||
|
|
||||||
|
def filter_is_variant(self, queryset, name, value):
|
||||||
|
"""Filter by whether the Part is a variant or not."""
|
||||||
|
return queryset.filter(variant_of__isnull=not str2bool(value))
|
||||||
|
|
||||||
is_revision = rest_filters.BooleanFilter(
|
is_revision = rest_filters.BooleanFilter(
|
||||||
label=_('Is Revision'), method='filter_is_revision'
|
label=_('Is Revision'), method='filter_is_revision'
|
||||||
)
|
)
|
||||||
|
@ -269,6 +269,12 @@ function partTableFilters(): TableFilter[] {
|
|||||||
description: t`Filter by parts which are templates`,
|
description: t`Filter by parts which are templates`,
|
||||||
type: 'boolean'
|
type: 'boolean'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'is_variant',
|
||||||
|
label: t`Is Variant`,
|
||||||
|
description: t`Filter by parts which are variants`,
|
||||||
|
type: 'boolean'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'is_revision',
|
name: 'is_revision',
|
||||||
label: t`Is Revision`,
|
label: t`Is Revision`,
|
||||||
|
Reference in New Issue
Block a user