mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Fix for #1661
This commit is contained in:
parent
8e6691ce36
commit
08fbdf660b
@ -161,6 +161,13 @@ class StockItemSerializer(InvenTreeModelSerializer):
|
|||||||
|
|
||||||
required_tests = serializers.IntegerField(source='required_test_count', read_only=True, required=False)
|
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):
|
def __init__(self, *args, **kwargs):
|
||||||
|
|
||||||
part_detail = kwargs.pop('part_detail', False)
|
part_detail = kwargs.pop('part_detail', False)
|
||||||
@ -215,6 +222,7 @@ class StockItemSerializer(InvenTreeModelSerializer):
|
|||||||
'tracking_items',
|
'tracking_items',
|
||||||
'uid',
|
'uid',
|
||||||
'updated',
|
'updated',
|
||||||
|
'purchase_price',
|
||||||
]
|
]
|
||||||
|
|
||||||
""" These fields are read-only in this context.
|
""" These fields are read-only in this context.
|
||||||
|
@ -660,6 +660,11 @@ function loadStockTable(table, options) {
|
|||||||
title: '{% trans "Last Updated" %}',
|
title: '{% trans "Last Updated" %}',
|
||||||
sortable: true,
|
sortable: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
field: 'purchase_price',
|
||||||
|
title: '{% trans "Purchase Price" %}',
|
||||||
|
sortable: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
field: 'packaging',
|
field: 'packaging',
|
||||||
title: '{% trans "Packaging" %}',
|
title: '{% trans "Packaging" %}',
|
||||||
|
Loading…
Reference in New Issue
Block a user