mirror of
https://github.com/inventree/InvenTree.git
synced 2025-09-14 06:31:27 +00:00
[UI] Report ouputs (#9003)
* Typo fixes * Display table of generated reports * Display generated label outputs * Translation * Allow sorting of API Endpoints * Add template detail to output serializers * Add extra table column
This commit is contained in:
@@ -1,13 +1,17 @@
|
||||
"""InvenTree API version information."""
|
||||
|
||||
# InvenTree API version
|
||||
INVENTREE_API_VERSION = 307
|
||||
INVENTREE_API_VERSION = 308
|
||||
|
||||
"""Increment this API version number whenever there is a significant change to the API that any clients need to know about."""
|
||||
|
||||
|
||||
INVENTREE_API_TEXT = """
|
||||
|
||||
v308 - 2025-02-01 : https://github.com/inventree/InvenTree/pull/9003
|
||||
- Adds extra detail to the ReportOutput and LabelOutput API endpoints
|
||||
- Allows ordering of output list endpoints
|
||||
|
||||
v307 - 2025-01-29 : https://github.com/inventree/InvenTree/pull/8969
|
||||
- Extend Info Endpoint to include customizations
|
||||
|
||||
|
@@ -19,7 +19,7 @@ import report.helpers
|
||||
import report.models
|
||||
import report.serializers
|
||||
from InvenTree.api import BulkDeleteMixin, MetadataView
|
||||
from InvenTree.filters import InvenTreeSearchFilter
|
||||
from InvenTree.filters import InvenTreeOrderingFilter, InvenTreeSearchFilter
|
||||
from InvenTree.mixins import ListAPI, ListCreateAPI, RetrieveUpdateDestroyAPI
|
||||
from plugin.builtin.labels.inventree_label import InvenTreeLabelPlugin
|
||||
|
||||
@@ -309,14 +309,26 @@ class ReportAssetDetail(TemplatePermissionMixin, RetrieveUpdateDestroyAPI):
|
||||
serializer_class = report.serializers.ReportAssetSerializer
|
||||
|
||||
|
||||
class LabelOutputList(TemplatePermissionMixin, BulkDeleteMixin, ListAPI):
|
||||
class TemplateOutputMixin:
|
||||
"""Mixin class for template output API endpoints."""
|
||||
|
||||
filter_backends = [InvenTreeOrderingFilter]
|
||||
ordering_fields = ['created', 'model_type', 'user']
|
||||
ordering_field_aliases = {'model_type': 'template__model_type'}
|
||||
|
||||
|
||||
class LabelOutputList(
|
||||
TemplatePermissionMixin, TemplateOutputMixin, BulkDeleteMixin, ListAPI
|
||||
):
|
||||
"""List endpoint for LabelOutput objects."""
|
||||
|
||||
queryset = report.models.LabelOutput.objects.all()
|
||||
serializer_class = report.serializers.LabelOutputSerializer
|
||||
|
||||
|
||||
class ReportOutputList(TemplatePermissionMixin, BulkDeleteMixin, ListAPI):
|
||||
class ReportOutputList(
|
||||
TemplatePermissionMixin, TemplateOutputMixin, BulkDeleteMixin, ListAPI
|
||||
):
|
||||
"""List endpoint for ReportOutput objects."""
|
||||
|
||||
queryset = report.models.ReportOutput.objects.all()
|
||||
|
@@ -193,7 +193,11 @@ class LabelOutputSerializer(BaseOutputSerializer):
|
||||
"""Metaclass options."""
|
||||
|
||||
model = report.models.LabelOutput
|
||||
fields = [*BaseOutputSerializer.base_fields(), 'plugin']
|
||||
fields = [*BaseOutputSerializer.base_fields(), 'plugin', 'template_detail']
|
||||
|
||||
template_detail = LabelTemplateSerializer(
|
||||
source='template', many=False, read_only=True
|
||||
)
|
||||
|
||||
|
||||
class ReportOutputSerializer(BaseOutputSerializer):
|
||||
@@ -203,7 +207,11 @@ class ReportOutputSerializer(BaseOutputSerializer):
|
||||
"""Metaclass options."""
|
||||
|
||||
model = report.models.ReportOutput
|
||||
fields = BaseOutputSerializer.base_fields()
|
||||
fields = [*BaseOutputSerializer.base_fields(), 'template_detail']
|
||||
|
||||
template_detail = ReportTemplateSerializer(
|
||||
source='template', many=False, read_only=True
|
||||
)
|
||||
|
||||
|
||||
class ReportSnippetSerializer(InvenTreeModelSerializer):
|
||||
|
Reference in New Issue
Block a user