mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Tweak the 'on_order' calculation
This commit is contained in:
parent
351c5fb7d0
commit
9efdd836f4
@ -327,7 +327,7 @@ class SupplierPart(models.Model):
|
||||
if q is None or r is None:
|
||||
return 0
|
||||
else:
|
||||
return q - r
|
||||
return max(q-r, 0)
|
||||
|
||||
|
||||
def purchase_orders(self):
|
||||
|
@ -809,7 +809,7 @@ class Part(models.Model):
|
||||
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()])
|
||||
return sum([part.on_order() for part in self.supplier_parts.all().prefetch_related('purchase_order_line_items')])
|
||||
|
||||
|
||||
def attach_file(instance, filename):
|
||||
|
Loading…
Reference in New Issue
Block a user