mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Filter API by overdue status
This commit is contained in:
parent
b21c6f0b99
commit
c34196538b
@ -266,6 +266,17 @@ class SOList(generics.ListCreateAPIView):
|
|||||||
else:
|
else:
|
||||||
queryset = queryset.exclude(status__in=SalesOrderStatus.OPEN)
|
queryset = queryset.exclude(status__in=SalesOrderStatus.OPEN)
|
||||||
|
|
||||||
|
# Filter by 'overdue' status
|
||||||
|
overdue = params.get('overdue', None)
|
||||||
|
|
||||||
|
if overdue is not None:
|
||||||
|
overdue = str2bool(overdue)
|
||||||
|
|
||||||
|
if overdue:
|
||||||
|
queryset = queryset.filter(SalesOrder.OVERDUE_FILTER)
|
||||||
|
else:
|
||||||
|
queryset = queryset.exclude(SalesOrder.OVERDUE_FILTER)
|
||||||
|
|
||||||
status = params.get('status', None)
|
status = params.get('status', None)
|
||||||
|
|
||||||
if status is not None:
|
if status is not None:
|
||||||
|
@ -128,6 +128,13 @@ class EditSalesOrderForm(HelperForm):
|
|||||||
|
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
# TODO: Improve this using a better date picker
|
||||||
|
target_date = forms.DateField(
|
||||||
|
widget=forms.DateInput(
|
||||||
|
attrs={'type': 'date'},
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = SalesOrder
|
model = SalesOrder
|
||||||
fields = [
|
fields = [
|
||||||
@ -135,6 +142,7 @@ class EditSalesOrderForm(HelperForm):
|
|||||||
'customer',
|
'customer',
|
||||||
'customer_reference',
|
'customer_reference',
|
||||||
'description',
|
'description',
|
||||||
|
'target_date',
|
||||||
'link'
|
'link'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -188,7 +188,6 @@ class SalesOrderSerializer(InvenTreeModelSerializer):
|
|||||||
|
|
||||||
fields = [
|
fields = [
|
||||||
'pk',
|
'pk',
|
||||||
'shipment_date',
|
|
||||||
'creation_date',
|
'creation_date',
|
||||||
'customer',
|
'customer',
|
||||||
'customer_detail',
|
'customer_detail',
|
||||||
@ -202,6 +201,7 @@ class SalesOrderSerializer(InvenTreeModelSerializer):
|
|||||||
'status',
|
'status',
|
||||||
'status_text',
|
'status_text',
|
||||||
'shipment_date',
|
'shipment_date',
|
||||||
|
'target_date',
|
||||||
]
|
]
|
||||||
|
|
||||||
read_only_fields = [
|
read_only_fields = [
|
||||||
|
@ -37,6 +37,9 @@ src="{% static 'img/blank_image.png' %}"
|
|||||||
</h3>
|
</h3>
|
||||||
<h3>
|
<h3>
|
||||||
{% sales_order_status_label order.status large=True %}
|
{% sales_order_status_label order.status large=True %}
|
||||||
|
{% if order.is_overdue %}
|
||||||
|
<span class='label label-large label-large-red'>{% trans "Overdue" %}</span>
|
||||||
|
{% endif %}
|
||||||
</h3>
|
</h3>
|
||||||
<hr>
|
<hr>
|
||||||
<p>{{ order.description }}</p>
|
<p>{{ order.description }}</p>
|
||||||
@ -74,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>{% sales_order_status_label order.status %}</td>
|
<td>
|
||||||
|
{% sales_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>
|
||||||
@ -100,6 +108,13 @@ src="{% static 'img/blank_image.png' %}"
|
|||||||
<td>{% trans "Created" %}</td>
|
<td>{% trans "Created" %}</td>
|
||||||
<td>{{ order.creation_date }}<span class='badge'>{{ order.created_by }}</span></td>
|
<td>{{ order.creation_date }}<span class='badge'>{{ order.created_by }}</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
{% 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.shipment_date %}
|
{% if order.shipment_date %}
|
||||||
<tr>
|
<tr>
|
||||||
<td><span class='fas fa-truck'></span></td>
|
<td><span class='fas fa-truck'></span></td>
|
||||||
|
@ -275,6 +275,11 @@ function loadSalesOrderTable(table, options) {
|
|||||||
field: 'creation_date',
|
field: 'creation_date',
|
||||||
title: '{% trans "Creation Date" %}',
|
title: '{% trans "Creation Date" %}',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
sortable: true,
|
||||||
|
field: 'target_date',
|
||||||
|
title: '{% trans "Target Date" %}',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: 'shipment_date',
|
field: 'shipment_date',
|
||||||
|
Loading…
Reference in New Issue
Block a user