2
0
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:
Oliver Walters
2019-05-09 20:30:23 +10:00
parent 2c5bb6b126
commit 45223fb607
5 changed files with 35 additions and 7 deletions

View File

@ -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):