2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-28 11:36:44 +00:00

Extend API for labels and reports to allow creating new items (#5982)

* Extend API for labels and reports to allow creating new items

* Increment API_VERSION

* Missed something..
This commit is contained in:
miggland 2023-11-26 10:52:03 +01:00 committed by GitHub
parent 90e6938eb6
commit 43434fc530
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 5 deletions

View File

@ -2,11 +2,14 @@
# InvenTree API version # InvenTree API version
INVENTREE_API_VERSION = 155 INVENTREE_API_VERSION = 156
"""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 = """
v156 -> 2023-11-26 : https://github.com/inventree/InvenTree/pull/5982
- Add POST endpoint for report and label creation
v155 -> 2023-11-24 : https://github.com/inventree/InvenTree/pull/5979 v155 -> 2023-11-24 : https://github.com/inventree/InvenTree/pull/5979
- Add "creation_date" field to Part instance serializer - Add "creation_date" field to Part instance serializer

View File

@ -18,7 +18,8 @@ import label.models
import label.serializers import label.serializers
from InvenTree.api import MetadataView from InvenTree.api import MetadataView
from InvenTree.filters import InvenTreeSearchFilter from InvenTree.filters import InvenTreeSearchFilter
from InvenTree.mixins import ListAPI, RetrieveAPI, RetrieveUpdateDestroyAPI from InvenTree.mixins import (ListCreateAPI, RetrieveAPI,
RetrieveUpdateDestroyAPI)
from part.models import Part from part.models import Part
from plugin.builtin.labels.inventree_label import InvenTreeLabelPlugin from plugin.builtin.labels.inventree_label import InvenTreeLabelPlugin
from plugin.registry import registry from plugin.registry import registry
@ -65,7 +66,7 @@ class LabelFilterMixin:
return self.ITEM_MODEL.objects.filter(pk__in=valid_ids) return self.ITEM_MODEL.objects.filter(pk__in=valid_ids)
class LabelListView(LabelFilterMixin, ListAPI): class LabelListView(LabelFilterMixin, ListCreateAPI):
"""Generic API class for label templates.""" """Generic API class for label templates."""
def filter_queryset(self, queryset): def filter_queryset(self, queryset):

View File

@ -20,7 +20,8 @@ import part.models
from InvenTree.api import MetadataView from InvenTree.api import MetadataView
from InvenTree.exceptions import log_error from InvenTree.exceptions import log_error
from InvenTree.filters import InvenTreeSearchFilter from InvenTree.filters import InvenTreeSearchFilter
from InvenTree.mixins import ListAPI, RetrieveAPI, RetrieveUpdateDestroyAPI from InvenTree.mixins import (ListCreateAPI, RetrieveAPI,
RetrieveUpdateDestroyAPI)
from stock.models import StockItem, StockItemAttachment, StockLocation from stock.models import StockItem, StockItemAttachment, StockLocation
from .models import (BillOfMaterialsReport, BuildReport, PurchaseOrderReport, from .models import (BillOfMaterialsReport, BuildReport, PurchaseOrderReport,
@ -33,7 +34,7 @@ from .serializers import (BOMReportSerializer, BuildReportSerializer,
StockLocationReportSerializer, TestReportSerializer) StockLocationReportSerializer, TestReportSerializer)
class ReportListView(ListAPI): class ReportListView(ListCreateAPI):
"""Generic API class for report templates.""" """Generic API class for report templates."""
filter_backends = [ filter_backends = [