mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-19 05:25:42 +00:00
There shouldn't be any blank lines after the function docstring. Remove the blank lines to fix this issue. Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
97 lines
2.5 KiB
Python
97 lines
2.5 KiB
Python
"""API serializers for the reporting models"""
|
|
|
|
from InvenTree.serializers import (InvenTreeAttachmentSerializerField,
|
|
InvenTreeModelSerializer)
|
|
|
|
from .models import (BillOfMaterialsReport, BuildReport, PurchaseOrderReport,
|
|
ReturnOrderReport, SalesOrderReport, StockLocationReport,
|
|
TestReport)
|
|
|
|
|
|
class ReportSerializerBase(InvenTreeModelSerializer):
|
|
"""Base class for report serializer"""
|
|
|
|
template = InvenTreeAttachmentSerializerField(required=True)
|
|
|
|
@staticmethod
|
|
def report_fields():
|
|
"""Generic serializer fields for a report template"""
|
|
return [
|
|
'pk',
|
|
'name',
|
|
'description',
|
|
'template',
|
|
'filters',
|
|
'enabled',
|
|
]
|
|
|
|
|
|
class TestReportSerializer(ReportSerializerBase):
|
|
"""Serializer class for the TestReport model"""
|
|
|
|
class Meta:
|
|
"""Metaclass options."""
|
|
|
|
model = TestReport
|
|
fields = ReportSerializerBase.report_fields()
|
|
|
|
|
|
class BuildReportSerializer(ReportSerializerBase):
|
|
"""Serializer class for the BuildReport model"""
|
|
|
|
class Meta:
|
|
"""Metaclass options."""
|
|
|
|
model = BuildReport
|
|
fields = ReportSerializerBase.report_fields()
|
|
|
|
|
|
class BOMReportSerializer(ReportSerializerBase):
|
|
"""Serializer class for the BillOfMaterialsReport model"""
|
|
|
|
class Meta:
|
|
"""Metaclass options."""
|
|
|
|
model = BillOfMaterialsReport
|
|
fields = ReportSerializerBase.report_fields()
|
|
|
|
|
|
class PurchaseOrderReportSerializer(ReportSerializerBase):
|
|
"""Serializer class for the PurchaseOrdeReport model"""
|
|
|
|
class Meta:
|
|
"""Metaclass options."""
|
|
|
|
model = PurchaseOrderReport
|
|
fields = ReportSerializerBase.report_fields()
|
|
|
|
|
|
class SalesOrderReportSerializer(ReportSerializerBase):
|
|
"""Serializer class for the SalesOrderReport model"""
|
|
|
|
class Meta:
|
|
"""Metaclass options."""
|
|
|
|
model = SalesOrderReport
|
|
fields = ReportSerializerBase.report_fields()
|
|
|
|
|
|
class ReturnOrderReportSerializer(ReportSerializerBase):
|
|
"""Serializer class for the ReturnOrderReport model"""
|
|
|
|
class Meta:
|
|
"""Metaclass options"""
|
|
|
|
model = ReturnOrderReport
|
|
fields = ReportSerializerBase.report_fields()
|
|
|
|
|
|
class StockLocationReportSerializer(ReportSerializerBase):
|
|
"""Serializer class for the StockLocationReport model"""
|
|
|
|
class Meta:
|
|
"""Metaclass options"""
|
|
|
|
model = StockLocationReport
|
|
fields = ReportSerializerBase.report_fields()
|