mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
[API] Add default location filter to part endpoint (#6016)
* Add default_location to part filters * Move to PartFilter class
This commit is contained in:
parent
f96055a33f
commit
03a8190195
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user