From 5af2fae1207770223e47e67b558c47e5d07590e0 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sun, 22 Mar 2020 19:47:08 +1100 Subject: [PATCH] Simplify URLs for purchase orders --- .../templates/company/company_base.html | 2 +- .../company/detail_purchase_orders.html | 2 +- .../order/templates/order/order_base.html | 6 ++--- .../order/templates/order/order_notes.html | 2 +- .../order/templates/order/po_attachments.html | 2 +- InvenTree/order/templates/order/po_table.html | 2 +- .../order/purchase_order_detail.html | 8 +++--- .../templates/order/purchase_orders.html | 4 +-- InvenTree/order/templates/order/tabs.html | 6 ++--- InvenTree/order/urls.py | 25 ++++++++++--------- .../stock/templates/stock/item_base.html | 2 +- InvenTree/templates/navbar.html | 2 +- 12 files changed, 32 insertions(+), 31 deletions(-) diff --git a/InvenTree/company/templates/company/company_base.html b/InvenTree/company/templates/company/company_base.html index 1080f01445..9e849e5a47 100644 --- a/InvenTree/company/templates/company/company_base.html +++ b/InvenTree/company/templates/company/company_base.html @@ -100,7 +100,7 @@ InvenTree | {% trans "Company" %} - {{ company.name }} }); $("#company-order-2").click(function() { - launchModalForm("{% url 'purchase-order-create' %}", + launchModalForm("{% url 'po-create' %}", { data: { supplier: {{ company.id }}, diff --git a/InvenTree/company/templates/company/detail_purchase_orders.html b/InvenTree/company/templates/company/detail_purchase_orders.html index fcba26e2af..c3878eec6d 100644 --- a/InvenTree/company/templates/company/detail_purchase_orders.html +++ b/InvenTree/company/templates/company/detail_purchase_orders.html @@ -28,7 +28,7 @@ function newOrder() { - launchModalForm("{% url 'purchase-order-create' %}", + launchModalForm("{% url 'po-create' %}", { data: { supplier: {{ company.id }}, diff --git a/InvenTree/order/templates/order/order_base.html b/InvenTree/order/templates/order/order_base.html index 2cefeb6465..80a33fbfa8 100644 --- a/InvenTree/order/templates/order/order_base.html +++ b/InvenTree/order/templates/order/order_base.html @@ -107,7 +107,7 @@ InvenTree | {{ order }} {% if order.status == OrderStatus.PENDING and order.lines.count > 0 %} $("#place-order").click(function() { - launchModalForm("{% url 'purchase-order-issue' order.id %}", + launchModalForm("{% url 'po-issue' order.id %}", { reload: true, }); @@ -115,7 +115,7 @@ $("#place-order").click(function() { {% endif %} $("#edit-order").click(function() { - launchModalForm("{% url 'purchase-order-edit' order.id %}", + launchModalForm("{% url 'po-edit' order.id %}", { reload: true, } @@ -123,7 +123,7 @@ $("#edit-order").click(function() { }); $("#cancel-order").click(function() { - launchModalForm("{% url 'purchase-order-cancel' order.id %}", { + launchModalForm("{% url 'po-cancel' order.id %}", { reload: true, }); }); diff --git a/InvenTree/order/templates/order/order_notes.html b/InvenTree/order/templates/order/order_notes.html index 9077108510..de4f18ba6b 100644 --- a/InvenTree/order/templates/order/order_notes.html +++ b/InvenTree/order/templates/order/order_notes.html @@ -50,7 +50,7 @@ {% if editing %} {% else %} $("#edit-notes").click(function() { - location.href = "{% url 'purchase-order-notes' order.id %}?edit=1"; + location.href = "{% url 'po-notes' order.id %}?edit=1"; }); {% endif %} diff --git a/InvenTree/order/templates/order/po_attachments.html b/InvenTree/order/templates/order/po_attachments.html index 13dad066df..4ba54a9c91 100644 --- a/InvenTree/order/templates/order/po_attachments.html +++ b/InvenTree/order/templates/order/po_attachments.html @@ -52,7 +52,7 @@ {{ block.super }} $("#new-attachment").click(function() { - launchModalForm("{% url 'purchase-order-attachment-create' %}?order={{ order.id }}", + launchModalForm("{% url 'po-attachment-create' %}?order={{ order.id }}", { reload: true, } diff --git a/InvenTree/order/templates/order/po_table.html b/InvenTree/order/templates/order/po_table.html index 0fe41e8efa..712553e866 100644 --- a/InvenTree/order/templates/order/po_table.html +++ b/InvenTree/order/templates/order/po_table.html @@ -12,7 +12,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" %} {{ order.lines.count }} diff --git a/InvenTree/order/templates/order/purchase_order_detail.html b/InvenTree/order/templates/order/purchase_order_detail.html index 15bc55a3d8..d2930cb8d1 100644 --- a/InvenTree/order/templates/order/purchase_order_detail.html +++ b/InvenTree/order/templates/order/purchase_order_detail.html @@ -92,7 +92,7 @@ $("#po-lines-table").on('click', ".line-receive", function() { console.log('clicked! ' + button.attr('pk')); - launchModalForm("{% url 'purchase-order-receive' order.id %}", { + launchModalForm("{% url 'po-receive' order.id %}", { reload: true, data: { line: button.attr('pk') @@ -109,7 +109,7 @@ $("#po-lines-table").on('click', ".line-receive", function() { }); $("#receive-order").click(function() { - launchModalForm("{% url 'purchase-order-receive' order.id %}", { + launchModalForm("{% url 'po-receive' order.id %}", { reload: true, secondary: [ { @@ -123,13 +123,13 @@ $("#receive-order").click(function() { }); $("#complete-order").click(function() { - launchModalForm("{% url 'purchase-order-complete' order.id %}", { + launchModalForm("{% url 'po-complete' order.id %}", { reload: true, }); }); $("#export-order").click(function() { - location.href = "{% url 'purchase-order-export' order.id %}"; + location.href = "{% url 'po-export' order.id %}"; }); {% if order.status == OrderStatus.PENDING %} diff --git a/InvenTree/order/templates/order/purchase_orders.html b/InvenTree/order/templates/order/purchase_orders.html index 17f3115c75..644e6418fa 100644 --- a/InvenTree/order/templates/order/purchase_orders.html +++ b/InvenTree/order/templates/order/purchase_orders.html @@ -18,7 +18,7 @@ InvenTree | Purchase Orders - +
{% endblock %} @@ -27,7 +27,7 @@ InvenTree | Purchase Orders {{ block.super }} $("#po-create").click(function() { - launchModalForm("{% url 'purchase-order-create' %}", + launchModalForm("{% url 'po-create' %}", { follow: true, } diff --git a/InvenTree/order/templates/order/tabs.html b/InvenTree/order/templates/order/tabs.html index f98822c769..f15acdd2b0 100644 --- a/InvenTree/order/templates/order/tabs.html +++ b/InvenTree/order/templates/order/tabs.html @@ -2,12 +2,12 @@ diff --git a/InvenTree/order/urls.py b/InvenTree/order/urls.py index 8a6613b563..c7fbc1e890 100644 --- a/InvenTree/order/urls.py +++ b/InvenTree/order/urls.py @@ -10,23 +10,24 @@ from django.conf.urls import url, include from . import views purchase_order_attachment_urls = [ - url(r'^new/', views.PurchaseOrderAttachmentCreate.as_view(), name='purchase-order-attachment-create'), + url(r'^new/', views.PurchaseOrderAttachmentCreate.as_view(), name='po-attachment-create'), + #url(r'^(?P\d+)/edit/', views.PurchaseOrderAttachmentEdit.as_view(), name='po-attachment-edit'), ] purchase_order_detail_urls = [ - url(r'^cancel/?', views.PurchaseOrderCancel.as_view(), name='purchase-order-cancel'), - url(r'^edit/?', views.PurchaseOrderEdit.as_view(), name='purchase-order-edit'), - url(r'^issue/?', views.PurchaseOrderIssue.as_view(), name='purchase-order-issue'), - url(r'^receive/?', views.PurchaseOrderReceive.as_view(), name='purchase-order-receive'), - url(r'^complete/?', views.PurchaseOrderComplete.as_view(), name='purchase-order-complete'), + url(r'^cancel/?', views.PurchaseOrderCancel.as_view(), name='po-cancel'), + url(r'^edit/?', views.PurchaseOrderEdit.as_view(), name='po-edit'), + url(r'^issue/?', views.PurchaseOrderIssue.as_view(), name='po-issue'), + url(r'^receive/?', views.PurchaseOrderReceive.as_view(), name='po-receive'), + url(r'^complete/?', views.PurchaseOrderComplete.as_view(), name='po-complete'), - url(r'^export/?', views.PurchaseOrderExport.as_view(), name='purchase-order-export'), + url(r'^export/?', views.PurchaseOrderExport.as_view(), name='po-export'), - url(r'^notes/', views.PurchaseOrderNotes.as_view(), name='purchase-order-notes'), + url(r'^notes/', views.PurchaseOrderNotes.as_view(), name='po-notes'), - url(r'^attachments/', views.PurchaseOrderDetail.as_view(template_name='order/po_attachments.html'), name='purchase-order-attachments'), - url(r'^.*$', views.PurchaseOrderDetail.as_view(), name='purchase-order-detail'), + url(r'^attachments/', views.PurchaseOrderDetail.as_view(template_name='order/po_attachments.html'), name='po-attachments'), + url(r'^.*$', views.PurchaseOrderDetail.as_view(), name='po-detail'), ] po_line_item_detail_urls = [ @@ -44,7 +45,7 @@ po_line_urls = [ purchase_order_urls = [ - url(r'^new/', views.PurchaseOrderCreate.as_view(), name='purchase-order-create'), + url(r'^new/', views.PurchaseOrderCreate.as_view(), name='po-create'), url(r'^order-parts/', views.OrderParts.as_view(), name='order-parts'), @@ -56,7 +57,7 @@ purchase_order_urls = [ url(r'^attachments/', include(purchase_order_attachment_urls)), # Display complete list of purchase orders - url(r'^.*$', views.PurchaseOrderIndex.as_view(), name='purchase-order-index'), + url(r'^.*$', views.PurchaseOrderIndex.as_view(), name='po-index'), ] order_urls = [ diff --git a/InvenTree/stock/templates/stock/item_base.html b/InvenTree/stock/templates/stock/item_base.html index 3e398ba16a..3f5fdca9ad 100644 --- a/InvenTree/stock/templates/stock/item_base.html +++ b/InvenTree/stock/templates/stock/item_base.html @@ -117,7 +117,7 @@ {% if item.purchase_order %} {% trans "Purchase Order" %} - {{ item.purchase_order }} + {{ item.purchase_order }} {% endif %} {% if item.customer %} diff --git a/InvenTree/templates/navbar.html b/InvenTree/templates/navbar.html index 691b73f982..c7e5a574e3 100644 --- a/InvenTree/templates/navbar.html +++ b/InvenTree/templates/navbar.html @@ -11,7 +11,7 @@
  • {% trans "Stock" %}
  • {% trans "Build" %}
  • {% trans "Suppliers" %}
  • -
  • {% trans "Orders" %}
  • +
  • {% trans "Orders" %}