From 47ada25315b9b051214cf60b28920a0634ab8cbc Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Mon, 20 Apr 2020 20:59:14 +1000 Subject: [PATCH] Add detail view for SalesOrder --- .../order/templates/order/order_base.html | 2 +- .../order/templates/order/order_notes.html | 2 +- .../order/templates/order/po_attachments.html | 2 +- .../order/{tabs.html => po_tabs.html} | 0 .../order/purchase_order_detail.html | 2 +- .../templates/order/sales_order_base.html | 110 ++++++++++++++++++ .../templates/order/sales_order_detail.html | 19 +++ InvenTree/order/templates/order/so_tabs.html | 17 +++ InvenTree/order/urls.py | 10 ++ InvenTree/order/views.py | 8 ++ 10 files changed, 168 insertions(+), 4 deletions(-) rename InvenTree/order/templates/order/{tabs.html => po_tabs.html} (100%) create mode 100644 InvenTree/order/templates/order/sales_order_base.html create mode 100644 InvenTree/order/templates/order/sales_order_detail.html create mode 100644 InvenTree/order/templates/order/so_tabs.html diff --git a/InvenTree/order/templates/order/order_base.html b/InvenTree/order/templates/order/order_base.html index 03aa4c4ce2..7576f061bc 100644 --- a/InvenTree/order/templates/order/order_base.html +++ b/InvenTree/order/templates/order/order_base.html @@ -6,7 +6,7 @@ {% load status_codes %} {% block page_title %} -InvenTree | {{ order }} +InvenTree | {% trans "Purchase Order" %} {% endblock %} {% block content %} diff --git a/InvenTree/order/templates/order/order_notes.html b/InvenTree/order/templates/order/order_notes.html index de4f18ba6b..1d2c19c6cb 100644 --- a/InvenTree/order/templates/order/order_notes.html +++ b/InvenTree/order/templates/order/order_notes.html @@ -7,7 +7,7 @@ {% block details %} -{% include 'order/tabs.html' with tab='notes' %} +{% include 'order/po_tabs.html' with tab='notes' %} {% if editing %}

{% trans "Order Notes" %}

diff --git a/InvenTree/order/templates/order/po_attachments.html b/InvenTree/order/templates/order/po_attachments.html index 173b0e1fb6..e8e2b4bbff 100644 --- a/InvenTree/order/templates/order/po_attachments.html +++ b/InvenTree/order/templates/order/po_attachments.html @@ -6,7 +6,7 @@ {% block details %} -{% include 'order/tabs.html' with tab='attachments' %} +{% include 'order/po_tabs.html' with tab='attachments' %}

{% trans "Purchase Order Attachments" %} diff --git a/InvenTree/order/templates/order/tabs.html b/InvenTree/order/templates/order/po_tabs.html similarity index 100% rename from InvenTree/order/templates/order/tabs.html rename to InvenTree/order/templates/order/po_tabs.html diff --git a/InvenTree/order/templates/order/purchase_order_detail.html b/InvenTree/order/templates/order/purchase_order_detail.html index 8196ada70d..5cea64ff53 100644 --- a/InvenTree/order/templates/order/purchase_order_detail.html +++ b/InvenTree/order/templates/order/purchase_order_detail.html @@ -7,7 +7,7 @@ {% block details %} -{% include 'order/tabs.html' with tab='details' %} +{% include 'order/po_tabs.html' with tab='details' %}
diff --git a/InvenTree/order/templates/order/sales_order_base.html b/InvenTree/order/templates/order/sales_order_base.html new file mode 100644 index 0000000000..adaed2b456 --- /dev/null +++ b/InvenTree/order/templates/order/sales_order_base.html @@ -0,0 +1,110 @@ +{% extends "base.html" %} + +{% load i18n %} +{% load static %} +{% load inventree_extras %} +{% load status_codes %} + +{% block page_title %} +InvenTree | {% trans "Sales Order" %} +{% endblock %} + +{% block content %} + + +
+
+
+
+ +
+
+

{{ order }}

+

{{ order.description }}

+

+

+
+ +
+
+

+
+
+
+
+

{% trans "Sales Order Details" %}

+ + + + + + + + + + + + + + + + + + {% if order.customer_reference %} + + + + + + {% endif %} + {% if order.link %} + + + + + + {% endif %} + + + + + + {% if order.issue_date %} + + + + + + {% endif %} + {% if order.status == OrderStatus.COMPLETE %} + + + + + + {% endif %} +
{% trans "Order Reference" %}{{ order.reference }}
{% trans "Order Status" %}{% order_status order.status %}
{% trans "Customer" %}{{ order.customer.name }}
{% trans "Customer Reference" %}{{ order.customer_reference }}
External Link{{ order.link }}
{% trans "Created" %}{{ order.creation_date }}{{ order.created_by }}
{% trans "Issued" %}{{ order.issue_date }}
{% trans "Received" %}{{ order.complete_date }}{{ order.received_by }}
+
+
+ +
+
+ {% block details %} + + {% endblock %} +
+ +{% endblock %} + +{% block js_ready %} +{{ block.super }} + +{% endblock %} \ No newline at end of file diff --git a/InvenTree/order/templates/order/sales_order_detail.html b/InvenTree/order/templates/order/sales_order_detail.html new file mode 100644 index 0000000000..3dc02363af --- /dev/null +++ b/InvenTree/order/templates/order/sales_order_detail.html @@ -0,0 +1,19 @@ +{% extends "order/sales_order_base.html" %} + +{% load inventree_extras %} +{% load status_codes %} +{% load i18n %} +{% load static %} + +{% block details %} + +{% include 'order/so_tabs.html' with tab='details' %} + +
+ +{% endblock %} + +{% block js_ready %} +{{ block.super }} + +{% endblock %} \ No newline at end of file diff --git a/InvenTree/order/templates/order/so_tabs.html b/InvenTree/order/templates/order/so_tabs.html new file mode 100644 index 0000000000..2bb313b0bb --- /dev/null +++ b/InvenTree/order/templates/order/so_tabs.html @@ -0,0 +1,17 @@ +{% load i18n %} + + \ No newline at end of file diff --git a/InvenTree/order/urls.py b/InvenTree/order/urls.py index a81cfcf239..e9a68f16a7 100644 --- a/InvenTree/order/urls.py +++ b/InvenTree/order/urls.py @@ -61,7 +61,17 @@ purchase_order_urls = [ url(r'^.*$', views.PurchaseOrderIndex.as_view(), name='po-index'), ] +sales_order_detail_urls = [ + + url(r'^.*$', views.SalesOrderDetail.as_view(), name='so-detail'), +] + sales_order_urls = [ + + # Display detail view for a single SalesOrder + url(r'^(?P\d+)/', include(sales_order_detail_urls)), + + # Display list of all sales orders url(r'^.*$', views.SalesOrderIndex.as_view(), name='so-index'), ] diff --git a/InvenTree/order/views.py b/InvenTree/order/views.py index 9e556e0321..5a2f0e1920 100644 --- a/InvenTree/order/views.py +++ b/InvenTree/order/views.py @@ -78,6 +78,14 @@ class PurchaseOrderDetail(DetailView): return ctx +class SalesOrderDetail(DetailView): + """ Detail view for a SalesOrder object """ + + context_object_name = 'order' + queryset = SalesOrder.objects.all().prefetch_related('lines') + template_name = 'order/sales_order_detail.html' + + class PurchaseOrderAttachmentCreate(AjaxCreateView): """ View for creating a new PurchaseOrderAtt