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.complete_date = datetime.now().date()
|
||||||
self.save()
|
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):
|
def can_cancel(self):
|
||||||
"""
|
"""
|
||||||
A PurchaseOrder can only be cancelled under the following circumstances:
|
A PurchaseOrder can only be cancelled under the following circumstances:
|
||||||
@ -440,17 +452,13 @@ class SalesOrder(Order):
|
|||||||
"""
|
"""
|
||||||
Returns true if this SalesOrder is "overdue":
|
Returns true if this SalesOrder is "overdue":
|
||||||
|
|
||||||
- Not completed
|
Makes use of the OVERDUE_FILTER to avoid code duplication.
|
||||||
- Target date is "in the past"
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Order cannot be deemed overdue if target_date is not set
|
query = SalesOrder.objects.filter(pk=self.pk)
|
||||||
if self.target_date is None:
|
query = query.filer(SalesOrder.OVERDUE_FILTER)
|
||||||
return False
|
|
||||||
|
|
||||||
today = datetime.now().date()
|
return query.exists()
|
||||||
|
|
||||||
return self.is_pending and self.target_date < today
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_pending(self):
|
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>
|
<a href="{% url 'admin:order_purchaseorder_change' order.pk %}"><span title='{% trans "Admin view" %}' class='fas fa-user-shield'></span></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</h3>
|
</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>
|
<hr>
|
||||||
<p>{{ order.description }}</p>
|
<p>{{ order.description }}</p>
|
||||||
<div class='btn-row'>
|
<div class='btn-row'>
|
||||||
@ -72,7 +77,12 @@ src="{% static 'img/blank_image.png' %}"
|
|||||||
<tr>
|
<tr>
|
||||||
<td><span class='fas fa-info'></span></td>
|
<td><span class='fas fa-info'></span></td>
|
||||||
<td>{% trans "Order Status" %}</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>
|
||||||
<tr>
|
<tr>
|
||||||
<td><span class='fas fa-building'></span></td>
|
<td><span class='fas fa-building'></span></td>
|
||||||
@ -105,6 +115,13 @@ src="{% static 'img/blank_image.png' %}"
|
|||||||
<td>{{ order.issue_date }}</td>
|
<td>{{ order.issue_date }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% 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 %}
|
{% if order.status == PurchaseOrderStatus.COMPLETE %}
|
||||||
<tr>
|
<tr>
|
||||||
<td><span class='fas fa-calendar-alt'></span></td>
|
<td><span class='fas fa-calendar-alt'></span></td>
|
||||||
|
Loading…
Reference in New Issue
Block a user