From 1456868d0309e45f0082971b1e9fc43dcfd99267 Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 22 Jun 2021 17:03:21 +1000 Subject: [PATCH] Add default values for line item serializers - Once https://github.com/inventree/InvenTree/issues/1687 is fixed, remove default values --- InvenTree/order/serializers.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/InvenTree/order/serializers.py b/InvenTree/order/serializers.py index bc3d72e739..821e8bf343 100644 --- a/InvenTree/order/serializers.py +++ b/InvenTree/order/serializers.py @@ -112,8 +112,9 @@ class POLineItemSerializer(InvenTreeModelSerializer): self.fields.pop('part_detail') self.fields.pop('supplier_part_detail') - quantity = serializers.FloatField() - received = serializers.FloatField() + # TODO: Once https://github.com/inventree/InvenTree/issues/1687 is fixed, remove default values + quantity = serializers.FloatField(default=1) + received = serializers.FloatField(default=0) part_detail = PartBriefSerializer(source='get_base_part', many=False, read_only=True) supplier_part_detail = SupplierPartSerializer(source='part', many=False, read_only=True) @@ -316,7 +317,9 @@ class SOLineItemSerializer(InvenTreeModelSerializer): part_detail = PartBriefSerializer(source='part', many=False, read_only=True) allocations = SalesOrderAllocationSerializer(many=True, read_only=True) - quantity = serializers.FloatField() + # TODO: Once https://github.com/inventree/InvenTree/issues/1687 is fixed, remove default values + quantity = serializers.FloatField(default=1) + allocated = serializers.FloatField(source='allocated_quantity', read_only=True) fulfilled = serializers.FloatField(source='fulfilled_quantity', read_only=True) sale_price_string = serializers.CharField(source='sale_price', read_only=True)