mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add "tracking items" back in
This commit is contained in:
parent
b2c40c91b7
commit
c72fce0cc5
@ -67,14 +67,27 @@ class StockItemSerializer(InvenTreeModelSerializer):
|
|||||||
'supplier_part__supplier',
|
'supplier_part__supplier',
|
||||||
'supplier_part__manufacturer',
|
'supplier_part__manufacturer',
|
||||||
'location',
|
'location',
|
||||||
'part'
|
'part',
|
||||||
|
'tracking_info',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def annotate_queryset(queryset):
|
||||||
|
"""
|
||||||
|
Add some extra annotations to the queryset,
|
||||||
|
performing database queries as efficiently as possible.
|
||||||
|
"""
|
||||||
|
|
||||||
|
# TODO
|
||||||
|
pass
|
||||||
|
|
||||||
status_text = serializers.CharField(source='get_status_display', read_only=True)
|
status_text = serializers.CharField(source='get_status_display', read_only=True)
|
||||||
|
|
||||||
part_detail = PartBriefSerializer(source='part', many=False, read_only=True)
|
part_detail = PartBriefSerializer(source='part', many=False, read_only=True)
|
||||||
location_detail = LocationBriefSerializer(source='location', many=False, read_only=True)
|
location_detail = LocationBriefSerializer(source='location', many=False, read_only=True)
|
||||||
|
|
||||||
|
tracking_items = serializers.IntegerField(source='tracking_info_count', read_only=True)
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
|
||||||
part_detail = kwargs.pop('part_detail', False)
|
part_detail = kwargs.pop('part_detail', False)
|
||||||
@ -105,6 +118,7 @@ class StockItemSerializer(InvenTreeModelSerializer):
|
|||||||
'supplier_part',
|
'supplier_part',
|
||||||
'status',
|
'status',
|
||||||
'status_text',
|
'status_text',
|
||||||
|
'tracking_items',
|
||||||
'uid',
|
'uid',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user