mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-14 19:15:41 +00:00
Display count badges in sidenav tree
Uses the 'tags' parameter as according to the docs - https://github.com/jonmiles/bootstrap-treeview - Part - Stock
This commit is contained in:
@ -48,6 +48,18 @@ class StockLocation(InvenTreeTree):
|
||||
}
|
||||
)
|
||||
|
||||
@property
|
||||
def stock_item_count(self):
|
||||
""" 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
|
||||
|
||||
|
||||
@receiver(pre_delete, sender=StockLocation, dispatch_uid='stocklocation_delete_log')
|
||||
def before_delete_stock_location(sender, instance, using, **kwargs):
|
||||
|
Reference in New Issue
Block a user