mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Adds API endpoint for listing stocktake information
This commit is contained in:
parent
15a9cdf94e
commit
ae4ae1c579
@ -38,7 +38,7 @@ from .models import (BomItem, BomItemSubstitute, Part, PartAttachment,
|
||||
PartCategory, PartCategoryParameterTemplate,
|
||||
PartInternalPriceBreak, PartParameter,
|
||||
PartParameterTemplate, PartRelated, PartSellPriceBreak,
|
||||
PartTestTemplate)
|
||||
PartStocktake, PartTestTemplate)
|
||||
|
||||
|
||||
class CategoryList(APIDownloadMixin, ListCreateAPI):
|
||||
@ -1696,6 +1696,27 @@ class PartParameterDetail(RetrieveUpdateDestroyAPI):
|
||||
serializer_class = part_serializers.PartParameterSerializer
|
||||
|
||||
|
||||
class PartStocktakeFilter(rest_filters.FilterSet):
|
||||
"""Custom fitler for the PartStocktakeList endpoint"""
|
||||
|
||||
class Meta:
|
||||
"""Metaclass options"""
|
||||
|
||||
model = PartStocktake
|
||||
fields = [
|
||||
'part',
|
||||
'user',
|
||||
]
|
||||
|
||||
|
||||
class PartStocktakeList(ListAPI):
|
||||
"""API endpoint for listing part stocktake information"""
|
||||
|
||||
queryset = PartStocktake.objects.all()
|
||||
serializer_class = part_serializers.PartStocktakeSerializer
|
||||
filterset_class = PartStocktakeFilter
|
||||
|
||||
|
||||
class BomFilter(rest_filters.FilterSet):
|
||||
"""Custom filters for the BOM list."""
|
||||
|
||||
@ -2111,6 +2132,11 @@ part_api_urls = [
|
||||
re_path(r'^.*$', PartParameterList.as_view(), name='api-part-parameter-list'),
|
||||
])),
|
||||
|
||||
# Part stocktake data
|
||||
re_path(r'^stocktake/', include([
|
||||
re_path(r'^.*$', PartStocktakeList.as_view(), name='api-part-stocktake-list'),
|
||||
])),
|
||||
|
||||
re_path(r'^thumbs/', include([
|
||||
path('', PartThumbs.as_view(), name='api-part-thumbs'),
|
||||
re_path(r'^(?P<pk>\d+)/?', PartThumbsUpdate.as_view(), name='api-part-thumbs-update'),
|
||||
|
@ -31,7 +31,8 @@ from .models import (BomItem, BomItemSubstitute, Part, PartAttachment,
|
||||
PartCategory, PartCategoryParameterTemplate,
|
||||
PartInternalPriceBreak, PartParameter,
|
||||
PartParameterTemplate, PartPricing, PartRelated,
|
||||
PartSellPriceBreak, PartStar, PartTestTemplate)
|
||||
PartSellPriceBreak, PartStar, PartStocktake,
|
||||
PartTestTemplate)
|
||||
|
||||
|
||||
class CategorySerializer(InvenTreeModelSerializer):
|
||||
@ -504,6 +505,22 @@ class PartSerializer(RemoteImageMixin, InvenTreeModelSerializer):
|
||||
return self.instance
|
||||
|
||||
|
||||
class PartStocktakeSerializer(InvenTreeModelSerializer):
|
||||
"""Serializer for the PartStocktake model"""
|
||||
|
||||
class Meta:
|
||||
"""Metaclass options"""
|
||||
|
||||
model = PartStocktake
|
||||
fields = [
|
||||
'pk',
|
||||
'date',
|
||||
'part',
|
||||
'quantity',
|
||||
'user',
|
||||
]
|
||||
|
||||
|
||||
class PartPricingSerializer(InvenTreeModelSerializer):
|
||||
"""Serializer for Part pricing information"""
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user