2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-03 04:00:57 +00:00

Display table of StockItems which have been split from the current item

- The StockItem list api now allows filtering by 'ancestor'
- Add 'children' tab for StockItem
- Needed to tweak the unit testing fixtures (yay thanks MPTT)
This commit is contained in:
Oliver Walters
2020-02-17 22:37:55 +11:00
parent 4f266958e3
commit ae4ebab957
7 changed files with 96 additions and 6 deletions

View File

@ -385,12 +385,17 @@ class StockItem(MPTTModel):
return True
@property
def children(self):
""" Return a list of the child items which have been split from this stock item """
return self.get_descendants(include_self=False)
@property
def child_count(self):
""" Return the number of 'child' items associated with this StockItem.
A child item is one which has been split from this one.
"""
return self.get_descendants(include_self=False).count()
return self.children.count()
@property
def in_stock(self):