Fix serializer for stock item

This commit is contained in:
Oliver Walters 2020-05-26 23:01:30 +10:00
parent 002b896384
commit 78990a99e5
3 changed files with 4 additions and 4 deletions

View File

@ -18,7 +18,7 @@
<a href="{% url 'part-stock' part.id %}">{% trans "Stock" %} <span class="badge">{% decimal part.total_stock %}</span></a> <a href="{% url 'part-stock' part.id %}">{% trans "Stock" %} <span class="badge">{% decimal part.total_stock %}</span></a>
</li> </li>
{% endif %} {% endif %}
{% if part.component or part.used_in_count > 0 %} {% if part.component or part.salable or part.used_in_count > 0 %}
<li{% ifequal tab 'allocation' %} class="active"{% endifequal %}> <li{% ifequal tab 'allocation' %} class="active"{% endifequal %}>
<a href="{% url 'part-allocation' part.id %}">{% trans "Allocated" %} <span class="badge">{% decimal part.allocation_count %}</span></a> <a href="{% url 'part-allocation' part.id %}">{% trans "Allocated" %} <span class="badge">{% decimal part.allocation_count %}</span></a>
</li> </li>

View File

@ -74,6 +74,6 @@ class BarcodePlugin(plugin.InvenTreePlugin):
Use the existing serializer to do this Use the existing serializer to do this
""" """
serializer = StockItemSerializer(item, part_detail=True, location_detail=True, supplier_detail=True) serializer = StockItemSerializer(item, part_detail=True, location_detail=True, supplier_part_detail=True)
return serializer.data return serializer.data

View File

@ -104,10 +104,10 @@ class StockItemSerializer(InvenTreeModelSerializer):
location_detail = LocationBriefSerializer(source='location', many=False, read_only=True) location_detail = LocationBriefSerializer(source='location', many=False, read_only=True)
supplier_part_detail = SupplierPartSerializer(source='supplier_part', many=False, read_only=True) supplier_part_detail = SupplierPartSerializer(source='supplier_part', many=False, read_only=True)
tracking_items = serializers.IntegerField() tracking_items = serializers.IntegerField(source='tracking_info_count')
quantity = serializers.FloatField() quantity = serializers.FloatField()
allocated = serializers.FloatField() allocated = serializers.FloatField(source='allocation_count')
required_tests = serializers.IntegerField(source='required_test_count', read_only=True) required_tests = serializers.IntegerField(source='required_test_count', read_only=True)