mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Bug fix for StockItem list API
- The wrong detail data was being set
This commit is contained in:
parent
4197e29fce
commit
7fca496de8
@ -294,7 +294,7 @@ class PartList(generics.ListCreateAPIView):
|
|||||||
def filter_queryset(self, queryset):
|
def filter_queryset(self, queryset):
|
||||||
"""
|
"""
|
||||||
Perform custom filtering of the queryset.
|
Perform custom filtering of the queryset.
|
||||||
We overide the DRF filter_fields here because
|
We overide the DRF filter_fields here because
|
||||||
"""
|
"""
|
||||||
|
|
||||||
queryset = super().filter_queryset(queryset)
|
queryset = super().filter_queryset(queryset)
|
||||||
|
@ -420,7 +420,7 @@ class StockList(generics.ListCreateAPIView):
|
|||||||
# Now update each StockItem with the related StockLocation data
|
# Now update each StockItem with the related StockLocation data
|
||||||
for stock_item in data:
|
for stock_item in data:
|
||||||
loc_id = stock_item['location']
|
loc_id = stock_item['location']
|
||||||
stock_item['supplier_detail'] = location_map.get(loc_id, None)
|
stock_item['location_detail'] = location_map.get(loc_id, None)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Determine the response type based on the request.
|
Determine the response type based on the request.
|
||||||
|
@ -87,10 +87,10 @@ class StockItemSerializer(InvenTreeModelSerializer):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
queryset = queryset.annotate(
|
queryset = queryset.annotate(
|
||||||
allocated = Coalesce(
|
allocated=Coalesce(
|
||||||
Sum('sales_order_allocations__quantity', distinct=True), 0) + Coalesce(
|
Sum('sales_order_allocations__quantity', distinct=True), 0) + Coalesce(
|
||||||
Sum('allocations__quantity', distinct=True), 0),
|
Sum('allocations__quantity', distinct=True), 0),
|
||||||
tracking_items = Count('tracking_info'),
|
tracking_items=Count('tracking_info'),
|
||||||
)
|
)
|
||||||
|
|
||||||
return queryset
|
return queryset
|
||||||
|
Loading…
Reference in New Issue
Block a user