2
0
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:
Oliver Walters
2019-06-11 21:58:20 +10:00
parent 50bab299c5
commit 8e82488f70
3 changed files with 20 additions and 3 deletions

View File

@@ -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 """