mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Display overdue status on PurcahseOrder page
This commit is contained in:
parent
a8e6d0a89f
commit
21e8ddd1e6
@ -273,6 +273,18 @@ class PurchaseOrder(Order):
|
||||
self.complete_date = datetime.now().date()
|
||||
self.save()
|
||||
|
||||
def is_overdue(self):
|
||||
"""
|
||||
Returns True if this PurchaseOrder is "overdue"
|
||||
|
||||
Makes use of the OVERDUE_FILTER to avoid code duplication.
|
||||
"""
|
||||
|
||||
query = PurchaseOrder.objects.filter(pk=self.pk)
|
||||
query = query.filter(PurchaseOrder.OVERDUE_FILTER)
|
||||
|
||||
return query.exists()
|
||||
|
||||
def can_cancel(self):
|
||||
"""
|
||||
A PurchaseOrder can only be cancelled under the following circumstances:
|
||||
@ -440,17 +452,13 @@ class SalesOrder(Order):
|
||||
"""
|
||||
Returns true if this SalesOrder is "overdue":
|
||||
|
||||
- Not completed
|
||||
- Target date is "in the past"
|
||||
Makes use of the OVERDUE_FILTER to avoid code duplication.
|
||||
"""
|
||||
|
||||
# Order cannot be deemed overdue if target_date is not set
|
||||
if self.target_date is None:
|
||||
return False
|
||||
query = SalesOrder.objects.filter(pk=self.pk)
|
||||
query = query.filer(SalesOrder.OVERDUE_FILTER)
|
||||
|
||||
today = datetime.now().date()
|
||||
|
||||
return self.is_pending and self.target_date < today
|
||||
return query.exists()
|
||||
|
||||
@property
|
||||
def is_pending(self):
|
||||
|
@ -26,7 +26,12 @@ src="{% static 'img/blank_image.png' %}"
|
||||
<a href="{% url 'admin:order_purchaseorder_change' order.pk %}"><span title='{% trans "Admin view" %}' class='fas fa-user-shield'></span></a>
|
||||
{% endif %}
|
||||
</h3>
|
||||
<h3>{% purchase_order_status_label order.status large=True %}</h3>
|
||||
<h3>
|
||||
{% purchase_order_status_label order.status large=True %}
|
||||
{% if order.is_overdue %}
|
||||
<span class='label label-large label-large-red'>{% trans "Overdue" %}</span>
|
||||
{% endif %}
|
||||
</h3>
|
||||
<hr>
|
||||
<p>{{ order.description }}</p>
|
||||
<div class='btn-row'>
|
||||
@ -72,7 +77,12 @@ src="{% static 'img/blank_image.png' %}"
|
||||
<tr>
|
||||
<td><span class='fas fa-info'></span></td>
|
||||
<td>{% trans "Order Status" %}</td>
|
||||
<td>{% purchase_order_status_label order.status %}</td>
|
||||
<td>
|
||||
{% purchase_order_status_label order.status %}
|
||||
{% if order.is_overdue %}
|
||||
<span class='label label-red'>{% trans "Overdue" %}</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span class='fas fa-building'></span></td>
|
||||
@ -105,6 +115,13 @@ src="{% static 'img/blank_image.png' %}"
|
||||
<td>{{ order.issue_date }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if order.target_date %}
|
||||
<tr>
|
||||
<td><span class='fas fa-calendar-alt'></span></td>
|
||||
<td>{% trans "Target Date" %}</td>
|
||||
<td>{{ order.target_date }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if order.status == PurchaseOrderStatus.COMPLETE %}
|
||||
<tr>
|
||||
<td><span class='fas fa-calendar-alt'></span></td>
|
||||
|
Loading…
Reference in New Issue
Block a user