mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-13 08:21:26 +00:00
Update 'Build'
- Part model now has active_builds and inactive_builds properties -
This commit is contained in:
@ -183,6 +183,28 @@ class Part(models.Model):
|
||||
|
||||
return total
|
||||
|
||||
@property
|
||||
def active_builds(self):
|
||||
""" Return a list of outstanding builds.
|
||||
Builds marked as 'complete' or 'cancelled' are ignored
|
||||
"""
|
||||
|
||||
return [b for b in self.builds.all() if b.is_active]
|
||||
|
||||
@property
|
||||
def inactive_builds(self):
|
||||
""" Return a list of inactive builds
|
||||
"""
|
||||
|
||||
return [b for b in self.builds.all() if not b.is_active]
|
||||
|
||||
@property
|
||||
def quantity_being_built(self):
|
||||
""" Return the current number of parts currently being built
|
||||
"""
|
||||
|
||||
return sum([b.quantity for b in self.active_builds])
|
||||
|
||||
@property
|
||||
def total_stock(self):
|
||||
""" Return the total stock quantity for this part.
|
||||
|
Reference in New Issue
Block a user