2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-08-07 20:32:12 +00:00

Add stock item filtering by sub-category

This commit is contained in:
Oliver Walters
2019-04-18 08:33:12 +10:00
parent 6b05078fd2
commit fd3f6ec21e
3 changed files with 35 additions and 5 deletions

View File

@@ -87,13 +87,12 @@ class PartList(generics.ListCreateAPIView):
childs = category.getUniqueChildren()
for child in childs:
# Ignore the top-level category (already filtered)
if child == cat_id:
if str(child) == str(cat_id):
continue
flt |= Q(category=child)
parts_list = parts_list.filter(flt)
# Default - return all parts
return parts_list
permission_classes = [