mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-13 08:21:26 +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:
@ -47,18 +47,17 @@ class PartCategory(InvenTreeTree):
|
||||
verbose_name = "Part Category"
|
||||
verbose_name_plural = "Part Categories"
|
||||
|
||||
@property
|
||||
def item_count(self):
|
||||
return self.partcount
|
||||
|
||||
@property
|
||||
def partcount(self):
|
||||
""" Return the total part count under this category
|
||||
(including children of child categories)
|
||||
"""
|
||||
|
||||
count = self.parts.count()
|
||||
|
||||
for child in self.children.all():
|
||||
count += child.partcount
|
||||
|
||||
return count
|
||||
return len(Part.objects.filter(category__in=self.getUniqueChildren()))
|
||||
|
||||
@property
|
||||
def has_parts(self):
|
||||
|
Reference in New Issue
Block a user