Add 'building' count to Part detail API

This commit is contained in:
Oliver Walters 2020-04-05 15:29:31 +10:00
parent 7c09c20725
commit b4d66c6797

View File

@ -83,7 +83,11 @@ class PartSerializer(InvenTreeModelSerializer):
thumbnail = serializers.CharField(source='get_thumbnail_url', read_only=True) thumbnail = serializers.CharField(source='get_thumbnail_url', read_only=True)
category_name = serializers.CharField(source='category_path', read_only=True) category_name = serializers.CharField(source='category_path', read_only=True)
allocated_stock = serializers.IntegerField(source='allocation_count', read_only=True) allocated_stock = serializers.FloatField(source='allocation_count', read_only=True)
on_order = serializers.FloatField(read_only=True)
building = serializers.FloatField(source='quantity_being_built', read_only=False)
@staticmethod @staticmethod
def setup_eager_loading(queryset): def setup_eager_loading(queryset):
@ -114,6 +118,7 @@ class PartSerializer(InvenTreeModelSerializer):
'total_stock', 'total_stock',
'allocated_stock', 'allocated_stock',
'on_order', 'on_order',
'building',
'units', 'units',
'trackable', 'trackable',
'assembly', 'assembly',