mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Fix display of parts currently being built
This commit is contained in:
parent
ba542dcbdb
commit
fcc35f2260
@ -1094,16 +1094,22 @@ class Part(MPTTModel):
|
||||
|
||||
@property
|
||||
def quantity_being_built(self):
|
||||
""" Return the current number of parts currently being built
|
||||
"""
|
||||
Return the current number of parts currently being built.
|
||||
|
||||
Note: This is the total quantity of Build orders, *not* the number of build outputs.
|
||||
In this fashion, it is the "projected" quantity of builds
|
||||
"""
|
||||
|
||||
stock_items = self.stock_items.filter(is_building=True)
|
||||
builds = self.active_builds
|
||||
|
||||
query = stock_items.aggregate(
|
||||
quantity=Coalesce(Sum('quantity'), Decimal(0))
|
||||
)
|
||||
quantity = 0
|
||||
|
||||
return query['quantity']
|
||||
for build in builds:
|
||||
# The remaining items in the build
|
||||
quantity += build.remaining
|
||||
|
||||
return quantity
|
||||
|
||||
def build_order_allocations(self):
|
||||
"""
|
||||
|
@ -164,7 +164,7 @@
|
||||
{% if quantity_being_built > 0 %}
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>{% trans "Underway" %}</td>
|
||||
<td>{% trans "Building" %}</td>
|
||||
<td>{% decimal quantity_being_built %}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
|
Loading…
Reference in New Issue
Block a user