Add shipment status to sales order page

This commit is contained in:
Oliver 2021-12-04 10:16:51 +11:00
parent 921ef5ae9e
commit 9ba6ac423d
2 changed files with 34 additions and 0 deletions

View File

@ -700,6 +700,30 @@ class SalesOrder(Order):
def pending_line_count(self):
return self.pending_line_items().count()
def completed_shipments(self):
"""
Return a queryset of the completed shipments for this order
"""
return self.shipments.exclude(shipment_date=None)
def pending_shipments(self):
"""
Return a queryset of the pending shipments for this order
"""
return self.shipments.filter(shipment_date=None)
@property
def shipment_count(self):
return self.shipments.count()
@property
def completed_shipment_count(self):
return self.completed_shipments().count()
@property
def pending_shipment_count(self):
return self.pending_shipments().count()
class PurchaseOrderAttachment(InvenTreeAttachment):
"""

View File

@ -135,6 +135,16 @@ src="{% static 'img/blank_image.png' %}"
{% endif %}
</td>
</tr>
<tr>
<td><span class='fas fa-truck'></span></td>
<td>{% trans "Completed Shipments" %}</td>
<td>
{{ order.completed_shipment_count }} / {{ order.shipment_count }}
{% if order.pending_shipment_count > 0 %}
<span class='badge bg-danger badge-right rounded-pill'>{% trans "Incomplete" %}</span>
{% endif %}
</td>
</tr>
{% if order.link %}
<tr>
<td><span class='fas fa-link'></span></td>