From c82d5482aa4b1627cf27065c118352ce84b8cae2 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Wed, 5 Jun 2019 00:17:25 +1000 Subject: [PATCH] Add a detail view for purchase orders --- .../order/templates/order/purchase_order_detail.html | 9 +++++++++ InvenTree/order/templates/order/purchase_orders.html | 2 +- InvenTree/order/urls.py | 8 ++++++++ InvenTree/order/views.py | 9 +++++++++ 4 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 InvenTree/order/templates/order/purchase_order_detail.html diff --git a/InvenTree/order/templates/order/purchase_order_detail.html b/InvenTree/order/templates/order/purchase_order_detail.html new file mode 100644 index 0000000000..bea88a21ba --- /dev/null +++ b/InvenTree/order/templates/order/purchase_order_detail.html @@ -0,0 +1,9 @@ +{% extends "base.html" %} + +{% block content %} + +Purchase Order: {{ order.reference }} +

+Description: {{ order.description }} + +{% endblock %} \ No newline at end of file diff --git a/InvenTree/order/templates/order/purchase_orders.html b/InvenTree/order/templates/order/purchase_orders.html index 4852284671..f85de6c962 100644 --- a/InvenTree/order/templates/order/purchase_orders.html +++ b/InvenTree/order/templates/order/purchase_orders.html @@ -17,7 +17,7 @@ {% for order in orders %} {% include "hover_image.html" with image=order.supplier.image hover=True %}{{ order.supplier.name }} - {{ order }} + {{ order }} {{ order.description }} {% include "order/order_status.html" %} diff --git a/InvenTree/order/urls.py b/InvenTree/order/urls.py index 905b01adb7..961cbb6857 100644 --- a/InvenTree/order/urls.py +++ b/InvenTree/order/urls.py @@ -9,8 +9,16 @@ from django.conf.urls import url, include from . import views +purchase_order_detail_urls = [ + + url(r'^.*$', views.PurchaseOrderDetail.as_view(), name='purchase-order-detail'), +] + purchase_order_urls = [ + # Display detail view for a single purchase order + url(r'^(?P\d+)/', include(purchase_order_detail_urls)), + # Display complete list of purchase orders url(r'^.*$', views.PurchaseOrderIndex.as_view(), name='purchase-order-index'), ] diff --git a/InvenTree/order/views.py b/InvenTree/order/views.py index fdbde9b8c0..add27967d7 100644 --- a/InvenTree/order/views.py +++ b/InvenTree/order/views.py @@ -13,6 +13,7 @@ from InvenTree.status_codes import OrderStatus class PurchaseOrderIndex(ListView): + """ List view for all purchase orders """ model = PurchaseOrder template_name = 'order/purchase_orders.html' @@ -24,3 +25,11 @@ class PurchaseOrderIndex(ListView): ctx['OrderStatus'] = OrderStatus return ctx + + +class PurchaseOrderDetail(DetailView): + """ Detail view for a PurchaseOrder object """ + + context_object_name = 'order' + queryset = PurchaseOrder.objects.all().prefetch_related('lines') + template_name = 'order/purchase_order_detail.html'