2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-13 08:21:26 +00:00

Merge pull request #288 from SchrodingersGat/tree-badges

Tree badges
This commit is contained in:
Oliver
2019-05-09 23:06:32 +10:00
committed by GitHub
13 changed files with 142 additions and 26 deletions

View File

@ -47,18 +47,18 @@ 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(),
active=True))
@property
def has_parts(self):