mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Coalesce baby, yeah!
This commit is contained in:
parent
2560613e36
commit
de6f2d37e5
@ -225,8 +225,8 @@ class PartList(generics.ListCreateAPIView):
|
|||||||
).annotate(
|
).annotate(
|
||||||
# Quantity of items which are "in stock"
|
# Quantity of items which are "in stock"
|
||||||
in_stock=Coalesce(Sum('stock_items__quantity', filter=stock_filter), Decimal(0)),
|
in_stock=Coalesce(Sum('stock_items__quantity', filter=stock_filter), Decimal(0)),
|
||||||
on_order=Sum('supplier_parts__purchase_order_line_items__quantity', filter=order_filter),
|
on_order=Coalesce(Sum('supplier_parts__purchase_order_line_items__quantity', filter=order_filter), Decimal(0)),
|
||||||
building=Sum('builds__quantity', filter=build_filter),
|
building=Coalesce(Sum('builds__quantity', filter=build_filter), Decimal(0)),
|
||||||
)
|
)
|
||||||
|
|
||||||
# If we are filtering by 'has_stock' status
|
# If we are filtering by 'has_stock' status
|
||||||
|
Loading…
Reference in New Issue
Block a user