2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-20 22:06:28 +00:00

Add some unit testing

This commit is contained in:
Oliver Walters
2020-10-05 00:29:06 +11:00
parent 26d113e8ad
commit fe3a72c6cc
3 changed files with 33 additions and 4 deletions

View File

@ -784,12 +784,13 @@ class Part(MPTTModel):
""" Return the current number of parts currently being built
"""
quantity = self.active_builds.aggregate(quantity=Sum('quantity'))['quantity']
stock_items = self.stock_items.filter(is_building=True)
if quantity is None:
quantity = 0
query = stock_items.aggregate(
quantity=Coalesce(Sum('quantity'), Decimal(0))
)
return quantity
return query['quantity']
def build_order_allocations(self):
"""