From 959914c78c59a9bd19b58d69a80b452267b3f0e7 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 14 Jan 2021 22:19:32 +1100 Subject: [PATCH] Display overdue purchase orders in the calendar view --- InvenTree/order/models.py | 9 ++++----- InvenTree/order/templates/order/purchase_orders.html | 2 ++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/InvenTree/order/models.py b/InvenTree/order/models.py index 955859f11a..84f6aeb6f0 100644 --- a/InvenTree/order/models.py +++ b/InvenTree/order/models.py @@ -135,7 +135,7 @@ class PurchaseOrder(Order): To be "interesting": - A "received" order where the received date lies within the date range - - TODO: A "pending" order where the target date lies within the date range + - A "pending" order where the target date lies within the date range - TODO: An "overdue" order where the target date is in the past """ @@ -152,13 +152,12 @@ class PurchaseOrder(Order): # Construct a queryset for "received" orders within the range received = Q(status=PurchaseOrderStatus.COMPLETE) & Q(complete_date__gte=min_date) & Q(complete_date__lte=max_date) - # TODO - Construct a queryset for "pending" orders within the range + # Construct a queryset for "pending" orders within the range + pending = Q(status__in=PurchaseOrderStatus.OPEN) & ~Q(target_date=None) & Q(target_date__gte=min_date) & Q(target_date__lte=max_date) # TODO - Construct a queryset for "overdue" orders within the range - flt = received - - queryset = queryset.filter(flt) + queryset = queryset.filter(received | pending) return queryset diff --git a/InvenTree/order/templates/order/purchase_orders.html b/InvenTree/order/templates/order/purchase_orders.html index d05e8fbf86..52314df833 100644 --- a/InvenTree/order/templates/order/purchase_orders.html +++ b/InvenTree/order/templates/order/purchase_orders.html @@ -70,6 +70,8 @@ InvenTree | {% trans "Purchase Orders" %} if (order.complete_date) { date = order.complete_date; + } else if (order.target_date) { + date = order.target_date; } var title = `${prefix}${order.reference} - ${order.supplier_detail.name}`;