This commit is contained in:
eeintech 2021-06-14 14:19:10 -04:00
parent 8e6691ce36
commit 08fbdf660b
2 changed files with 13 additions and 0 deletions

View File

@ -161,6 +161,13 @@ class StockItemSerializer(InvenTreeModelSerializer):
required_tests = serializers.IntegerField(source='required_test_count', read_only=True, required=False)
purchase_price = serializers.SerializerMethodField()
def get_purchase_price(self, obj):
""" Return purchase_price (Money field) as string (includes currency) """
return str(obj.purchase_price) if obj.purchase_price else '-'
def __init__(self, *args, **kwargs):
part_detail = kwargs.pop('part_detail', False)
@ -215,6 +222,7 @@ class StockItemSerializer(InvenTreeModelSerializer):
'tracking_items',
'uid',
'updated',
'purchase_price',
]
""" These fields are read-only in this context.

View File

@ -660,6 +660,11 @@ function loadStockTable(table, options) {
title: '{% trans "Last Updated" %}',
sortable: true,
},
{
field: 'purchase_price',
title: '{% trans "Purchase Price" %}',
sortable: true,
},
{
field: 'packaging',
title: '{% trans "Packaging" %}',