mirror of
https://github.com/inventree/InvenTree.git
synced 2025-08-07 12:22:11 +00:00
Display 'net stock' value on front page
This commit is contained in:
@@ -410,6 +410,19 @@ class Part(models.Model):
|
||||
|
||||
return max(total, 0)
|
||||
|
||||
@property
|
||||
def net_stock(self):
|
||||
""" Return the 'net' stock. It takes into account:
|
||||
|
||||
- Stock on hand (total_stock)
|
||||
- Stock on order (on_order)
|
||||
- Stock allocated (allocation_count)
|
||||
|
||||
This number (unlike 'available_stock') can be negative.
|
||||
"""
|
||||
|
||||
return self.total_stock - self.allocation_count + self.on_order
|
||||
|
||||
def isStarredBy(self, user):
|
||||
""" Return True if this part has been starred by a particular user """
|
||||
|
||||
|
Reference in New Issue
Block a user