diff --git a/InvenTree/build/api.py b/InvenTree/build/api.py index fedfe53008..393bd1f073 100644 --- a/InvenTree/build/api.py +++ b/InvenTree/build/api.py @@ -1,5 +1,5 @@ """ -Provides a JSON API for the Build app +JSON API for the Build app """ # -*- coding: utf-8 -*- diff --git a/InvenTree/company/forms.py b/InvenTree/company/forms.py index 7bb9e382c9..bf7057a1ea 100644 --- a/InvenTree/company/forms.py +++ b/InvenTree/company/forms.py @@ -1,5 +1,5 @@ """ -Django Forms for interacting with Company objects +Django Forms for interacting with Company app """ # -*- coding: utf-8 -*- diff --git a/InvenTree/company/urls.py b/InvenTree/company/urls.py index 13c478f28a..2c5018ebec 100644 --- a/InvenTree/company/urls.py +++ b/InvenTree/company/urls.py @@ -1,3 +1,8 @@ +""" +URL lookup for Company app +""" + + from django.conf.urls import url, include from django.views.generic.base import RedirectView diff --git a/InvenTree/stock/api.py b/InvenTree/stock/api.py index 215a9e311f..c352605ad2 100644 --- a/InvenTree/stock/api.py +++ b/InvenTree/stock/api.py @@ -1,3 +1,7 @@ +""" +JSON API for the Stock app +""" + from django_filters.rest_framework import FilterSet, DjangoFilterBackend from django_filters import NumberFilter @@ -26,7 +30,7 @@ class StockCategoryTree(TreeSerializer): class StockDetail(generics.RetrieveUpdateDestroyAPIView): - """ + """ API detail endpoint for Stock object get: Return a single StockItem object @@ -44,6 +48,11 @@ class StockDetail(generics.RetrieveUpdateDestroyAPIView): class StockFilter(FilterSet): + """ FilterSet for advanced stock filtering. + + Allows greater-than / less-than filtering for stock quantity + """ + min_stock = NumberFilter(name='quantity', lookup_expr='gte') max_stock = NumberFilter(name='quantity', lookup_expr='lte') @@ -53,12 +62,11 @@ class StockFilter(FilterSet): class StockStocktake(APIView): - """ - Stocktake API endpoint provides stock update of multiple items simultaneously + """ Stocktake API endpoint provides stock update of multiple items simultaneously. The 'action' field tells the type of stock action to perform: - * 'stocktake' - Count the stock item(s) - * 'remove' - Remove the quantity provided from stock - * 'add' - Add the quantity provided from stock + - stocktake: Count the stock item(s) + - remove: Remove the quantity provided from stock + - add: Add the quantity provided from stock """ permission_classes = [ @@ -129,6 +137,7 @@ class StockStocktake(APIView): class StockMove(APIView): + """ API endpoint for performing stock movements """ permission_classes = [ permissions.IsAuthenticatedOrReadOnly, @@ -183,6 +192,11 @@ class StockMove(APIView): class StockLocationList(generics.ListCreateAPIView): + """ API endpoint for list view of StockLocation objects: + + - GET: Return list of StockLocation objects + - POST: Create a new StockLocation + """ queryset = StockLocation.objects.all() @@ -204,14 +218,10 @@ class StockLocationList(generics.ListCreateAPIView): class StockList(generics.ListCreateAPIView): - """ + """ API endpoint for list view of Stock objects - get: - Return a list of all StockItem objects - (with optional query filters) - - post: - Create a new StockItem + - GET: Return a list of all StockItem objects (with optional query filters) + - POST: Create a new StockItem """ def get_queryset(self): @@ -268,6 +278,7 @@ class StockList(generics.ListCreateAPIView): class StockStocktakeEndpoint(generics.UpdateAPIView): + """ API endpoint for performing stocktake """ queryset = StockItem.objects.all() serializer_class = StockQuantitySerializer @@ -283,6 +294,13 @@ class StockStocktakeEndpoint(generics.UpdateAPIView): class StockTrackingList(generics.ListCreateAPIView): + """ API endpoint for list view of StockItemTracking objects. + + StockItemTracking objects are read-only + (they are created by internal model functionality) + + - GET: Return list of StockItemTracking objects + """ queryset = StockItemTracking.objects.all() serializer_class = StockTrackingSerializer @@ -312,17 +330,11 @@ class StockTrackingList(generics.ListCreateAPIView): class LocationDetail(generics.RetrieveUpdateDestroyAPIView): - """ - - get: - Return a single StockLocation object - - post: - Update a StockLocation object - - delete: - Remove a StockLocation object + """ API endpoint for detail view of StockLocation object + - GET: Return a single StockLocation object + - PATCH: Update a StockLocation object + - DELETE: Remove a StockLocation object """ queryset = StockLocation.objects.all() diff --git a/InvenTree/stock/forms.py b/InvenTree/stock/forms.py index bd0254e720..a94156ad29 100644 --- a/InvenTree/stock/forms.py +++ b/InvenTree/stock/forms.py @@ -1,3 +1,7 @@ +""" +Django Forms for interacting with Stock app +""" + # -*- coding: utf-8 -*- from __future__ import unicode_literals @@ -8,6 +12,7 @@ from .models import StockLocation, StockItem class EditStockLocationForm(HelperForm): + """ Form for editing a StockLocation """ class Meta: model = StockLocation @@ -19,6 +24,7 @@ class EditStockLocationForm(HelperForm): class CreateStockItemForm(HelperForm): + """ Form for creating a new StockItem """ class Meta: model = StockItem @@ -38,6 +44,7 @@ class CreateStockItemForm(HelperForm): class MoveStockItemForm(forms.ModelForm): + """ Form for moving a StockItem to a new location """ note = forms.CharField(label='Notes', required=True, help_text='Add note (required)') @@ -60,6 +67,7 @@ class StocktakeForm(forms.ModelForm): class EditStockItemForm(HelperForm): + """ Form for editing a StockItem object """ class Meta: model = StockItem diff --git a/InvenTree/stock/models.py b/InvenTree/stock/models.py index 4b1505d2d0..636efeb293 100644 --- a/InvenTree/stock/models.py +++ b/InvenTree/stock/models.py @@ -1,3 +1,8 @@ +""" +Stock database model definitions +""" + + # -*- coding: utf-8 -*- from __future__ import unicode_literals diff --git a/InvenTree/stock/serializers.py b/InvenTree/stock/serializers.py index 64baeb5330..0a863aa7f9 100644 --- a/InvenTree/stock/serializers.py +++ b/InvenTree/stock/serializers.py @@ -1,3 +1,7 @@ +""" +JSON serializers for Stock app +""" + from rest_framework import serializers from .models import StockItem, StockLocation @@ -44,8 +48,8 @@ class StockItemSerializerBrief(serializers.ModelSerializer): class StockItemSerializer(serializers.ModelSerializer): - """ - Serializer for a StockItem + """ Serializer for a StockItem: + - Includes serialization for the linked part - Includes serialization for the item location """ @@ -112,6 +116,7 @@ class LocationSerializer(serializers.ModelSerializer): class StockTrackingSerializer(serializers.ModelSerializer): + """ Serializer for StockItemTracking model """ url = serializers.CharField(source='get_absolute_url', read_only=True) diff --git a/InvenTree/stock/urls.py b/InvenTree/stock/urls.py index 503c9e809c..6b3fc0ff2d 100644 --- a/InvenTree/stock/urls.py +++ b/InvenTree/stock/urls.py @@ -1,3 +1,7 @@ +""" +URL lookup for Stock app +""" + from django.conf.urls import url, include from . import views diff --git a/InvenTree/stock/views.py b/InvenTree/stock/views.py index fc1d2726aa..70d3f7ded3 100644 --- a/InvenTree/stock/views.py +++ b/InvenTree/stock/views.py @@ -1,3 +1,7 @@ +""" +Django views for interacting with Stock app +""" + # -*- coding: utf-8 -*- from __future__ import unicode_literals @@ -19,8 +23,7 @@ from .forms import StocktakeForm class StockIndex(ListView): - """ - StockIndex view loads all StockLocation and StockItem object + """ StockIndex view loads all StockLocation and StockItem object """ model = StockItem template_name = 'stock/location.html'