2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-08-10 05:40:55 +00:00

Fixed up some stupid recursion on the Tree model template

This commit is contained in:
Oliver Walters
2019-06-18 00:59:54 +10:00
parent 642660d76e
commit 16b6ae8d61
8 changed files with 73 additions and 39 deletions

View File

@@ -73,10 +73,12 @@ class PartCategory(InvenTreeTree):
(including children of child categories)
"""
cats = [self.id]
if cascade:
query = Part.objects.filter(category__in=self.getUniqueChildren())
else:
query = Part.objects.filter(category=self)
cats += [cat for cat in self.getUniqueChildren()]
query = Part.objects.filter(category__in=cats)
if active:
query = query.filter(active=True)