mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
use more abstract definitions
This commit is contained in:
parent
0a1961bc31
commit
d086f09771
@ -40,7 +40,19 @@ import stock.serializers
|
|||||||
from users.serializers import OwnerSerializer
|
from users.serializers import OwnerSerializer
|
||||||
|
|
||||||
|
|
||||||
class POSerializer(ReferenceIndexingSerializerMixin, InvenTreeModelSerializer):
|
class AbstractOrderSerializer:
|
||||||
|
"""
|
||||||
|
Abstract field definitions for OrderSerializers
|
||||||
|
"""
|
||||||
|
total_price = InvenTreeMoneySerializer(
|
||||||
|
source='get_total_price',
|
||||||
|
allow_null=True,
|
||||||
|
read_only=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
total_price_string = serializers.CharField(source='get_total_price', read_only=True)
|
||||||
|
|
||||||
|
|
||||||
""" Serializer for a PurchaseOrder object """
|
""" Serializer for a PurchaseOrder object """
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
@ -467,7 +479,7 @@ class POAttachmentSerializer(InvenTreeAttachmentSerializer):
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class SalesOrderSerializer(ReferenceIndexingSerializerMixin, InvenTreeModelSerializer):
|
class SalesOrderSerializer(AbstractOrderSerializer, ReferenceIndexingSerializerMixin, InvenTreeModelSerializer):
|
||||||
"""
|
"""
|
||||||
Serializers for the SalesOrder object
|
Serializers for the SalesOrder object
|
||||||
"""
|
"""
|
||||||
@ -515,14 +527,6 @@ class SalesOrderSerializer(ReferenceIndexingSerializerMixin, InvenTreeModelSeria
|
|||||||
|
|
||||||
reference = serializers.CharField(required=True)
|
reference = serializers.CharField(required=True)
|
||||||
|
|
||||||
total_price = InvenTreeMoneySerializer(
|
|
||||||
source='get_total_price',
|
|
||||||
allow_null=True,
|
|
||||||
read_only=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
total_price_string = serializers.CharField(source='get_total_price', read_only=True)
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = order.models.SalesOrder
|
model = order.models.SalesOrder
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user