2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-19 21:45:39 +00:00

Calculate parts on order for a Part / SupplierPart

This commit is contained in:
Oliver Walters
2019-06-07 08:37:25 +10:00
parent 4af1f6ca9f
commit 31ad31365a
4 changed files with 46 additions and 11 deletions

View File

@ -806,6 +806,11 @@ class Part(models.Model):
return orders
def on_order(self):
""" Return the total number of items on order for this part. """
return sum([part.on_order() for part in self.supplier_parts.all()])
def attach_file(instance, filename):
""" Function for storing a file for a PartAttachment

View File

@ -96,6 +96,12 @@
<td>{{ part.allocation_count }}</td>
</tr>
{% endif %}
{% if part.on_order > 0 %}
<tr>
<td>On Order</td>
<td>{{ part.on_order }}</td>
</tr>
{% endif %}
</table>
</div>
</div>