2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-02 03:30:54 +00:00

More test coverage for Stock

This commit is contained in:
Oliver Walters
2019-05-13 18:45:52 +10:00
parent 42bbf95c42
commit 0813f8cbd5
5 changed files with 80 additions and 12 deletions

View File

@ -53,12 +53,7 @@ class StockLocation(InvenTreeTree):
""" Return the number of StockItem objects which live in or under this category
"""
return len(StockItem.objects.filter(location__in=self.getUniqueChildren()))
@property
def item_count(self):
return self.stock_item_count
return StockItem.objects.filter(location__in=self.getUniqueChildren()).count()
@receiver(pre_delete, sender=StockLocation, dispatch_uid='stocklocation_delete_log')
@ -444,9 +439,6 @@ class StockItem(models.Model):
""" Remove items from stock
"""
if self.quantity == 0:
return False
quantity = int(quantity)
if quantity <= 0 or self.infinite: