[API] Add default location filter to part endpoint (#6016)

* Add default_location to part filters

* Move to PartFilter class
This commit is contained in:
Lavissa 2023-12-05 02:20:36 +01:00 committed by GitHub
parent f96055a33f
commit 03a8190195
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,6 +33,7 @@ from InvenTree.status_codes import (BuildStatusGroups,
PurchaseOrderStatusGroups,
SalesOrderStatusGroups)
from part.admin import PartCategoryResource, PartResource
from stock.models import StockLocation
from . import serializers as part_serializers
from . import views
@ -950,6 +951,8 @@ class PartFilter(rest_filters.FilterSet):
return queryset.filter(Q(in_stock=0) & ~Q(stock_item_count=0))
return queryset.exclude(Q(in_stock=0) & ~Q(stock_item_count=0))
default_location = rest_filters.ModelChoiceFilter(label="Default Location", queryset=StockLocation.objects.all())
is_template = rest_filters.BooleanFilter()
assembly = rest_filters.BooleanFilter()