mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Use 'on_order' count in calculation for parts we need to order
This commit is contained in:
parent
04a9b1a980
commit
3954b33fb7
@ -21,6 +21,7 @@ class PurchaseOrderLineItemAdmin(admin.ModelAdmin):
|
||||
|
||||
list_display = (
|
||||
'order',
|
||||
'part',
|
||||
'quantity',
|
||||
'reference'
|
||||
)
|
||||
|
@ -427,7 +427,7 @@ class Part(models.Model):
|
||||
then we need to restock.
|
||||
"""
|
||||
|
||||
return (self.total_stock - self.allocation_count) < self.minimum_stock
|
||||
return (self.total_stock + self.on_order - self.allocation_count) < self.minimum_stock
|
||||
|
||||
@property
|
||||
def can_build(self):
|
||||
@ -816,6 +816,7 @@ class Part(models.Model):
|
||||
|
||||
return [order for order in self.purchase_orders() if order.status not in OrderStatus.OPEN]
|
||||
|
||||
@property
|
||||
def on_order(self):
|
||||
""" Return the total number of items on order for this part. """
|
||||
|
||||
|
@ -2,16 +2,18 @@
|
||||
<tr>
|
||||
<th>Part</th>
|
||||
<th>Description</th>
|
||||
<th>Required</th>
|
||||
<th>In Stock</th>
|
||||
<th>Allocated</th>
|
||||
<th>On Order</th>
|
||||
<th>Net Stock</th>
|
||||
</tr>
|
||||
{% for part in parts %}
|
||||
<tr>
|
||||
<td><a href="{% url 'part-detail' part.id %}">{{ part.full_name }}</a></td>
|
||||
<td>{{ part.description }}</td>
|
||||
<td>{{ part.total_stock }}</td>
|
||||
<td>{{ part.allocation_count }}</td>
|
||||
<td>{{ part.total_stock }}</td>
|
||||
<td>{{ part.on_order }}</td>
|
||||
<td>{{ part.available_stock }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
Loading…
Reference in New Issue
Block a user