2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-14 19:15:41 +00:00
- Turns out 'item_count' was actually used for something (that I wrote... recently...)
This commit is contained in:
Oliver Walters
2019-05-13 18:52:54 +10:00
parent b7d3bbd836
commit 150c68e65b
3 changed files with 10 additions and 3 deletions

View File

@ -55,6 +55,13 @@ class StockLocation(InvenTreeTree):
return StockItem.objects.filter(location__in=self.getUniqueChildren()).count()
@property
def item_count(self):
""" Simply returns the number of stock items in this location.
Required for tree view serializer.
"""
return self.stock_item_count
@receiver(pre_delete, sender=StockLocation, dispatch_uid='stocklocation_delete_log')
def before_delete_stock_location(sender, instance, using, **kwargs):

View File

@ -79,7 +79,7 @@ class StockTest(TestCase):
# Drawer 3 should have three stock items
self.assertEqual(self.drawer3.stock_items.count(), 3)
self.assertEqual(self.drawer3.stock_item_count, 3)
self.assertEqual(self.drawer3.item_count, 3)
def test_stock_count(self):
part = Part.objects.get(pk=1)