Simplify URLs for purchase orders

This commit is contained in:
Oliver Walters 2020-03-22 19:47:08 +11:00
parent 834f80698b
commit 5af2fae120
12 changed files with 32 additions and 31 deletions

View File

@ -100,7 +100,7 @@ InvenTree | {% trans "Company" %} - {{ company.name }}
}); });
$("#company-order-2").click(function() { $("#company-order-2").click(function() {
launchModalForm("{% url 'purchase-order-create' %}", launchModalForm("{% url 'po-create' %}",
{ {
data: { data: {
supplier: {{ company.id }}, supplier: {{ company.id }},

View File

@ -28,7 +28,7 @@
function newOrder() { function newOrder() {
launchModalForm("{% url 'purchase-order-create' %}", launchModalForm("{% url 'po-create' %}",
{ {
data: { data: {
supplier: {{ company.id }}, supplier: {{ company.id }},

View File

@ -107,7 +107,7 @@ InvenTree | {{ order }}
{% if order.status == OrderStatus.PENDING and order.lines.count > 0 %} {% if order.status == OrderStatus.PENDING and order.lines.count > 0 %}
$("#place-order").click(function() { $("#place-order").click(function() {
launchModalForm("{% url 'purchase-order-issue' order.id %}", launchModalForm("{% url 'po-issue' order.id %}",
{ {
reload: true, reload: true,
}); });
@ -115,7 +115,7 @@ $("#place-order").click(function() {
{% endif %} {% endif %}
$("#edit-order").click(function() { $("#edit-order").click(function() {
launchModalForm("{% url 'purchase-order-edit' order.id %}", launchModalForm("{% url 'po-edit' order.id %}",
{ {
reload: true, reload: true,
} }
@ -123,7 +123,7 @@ $("#edit-order").click(function() {
}); });
$("#cancel-order").click(function() { $("#cancel-order").click(function() {
launchModalForm("{% url 'purchase-order-cancel' order.id %}", { launchModalForm("{% url 'po-cancel' order.id %}", {
reload: true, reload: true,
}); });
}); });

View File

@ -50,7 +50,7 @@
{% if editing %} {% if editing %}
{% else %} {% else %}
$("#edit-notes").click(function() { $("#edit-notes").click(function() {
location.href = "{% url 'purchase-order-notes' order.id %}?edit=1"; location.href = "{% url 'po-notes' order.id %}?edit=1";
}); });
{% endif %} {% endif %}

View File

@ -52,7 +52,7 @@
{{ block.super }} {{ block.super }}
$("#new-attachment").click(function() { $("#new-attachment").click(function() {
launchModalForm("{% url 'purchase-order-attachment-create' %}?order={{ order.id }}", launchModalForm("{% url 'po-attachment-create' %}?order={{ order.id }}",
{ {
reload: true, reload: true,
} }

View File

@ -12,7 +12,7 @@
{% for order in orders %} {% for order in orders %}
<tr> <tr>
<td>{% include "hover_image.html" with image=order.supplier.image hover=True %}<a href="{{ order.supplier.get_absolute_url }}purchase-orders/">{{ order.supplier.name }}</a></td> <td>{% include "hover_image.html" with image=order.supplier.image hover=True %}<a href="{{ order.supplier.get_absolute_url }}purchase-orders/">{{ order.supplier.name }}</a></td>
<td><a href="{% url 'purchase-order-detail' order.id %}">{{ order }}</a></td> <td><a href="{% url 'po-detail' order.id %}">{{ order }}</a></td>
<td>{{ order.description }}</td> <td>{{ order.description }}</td>
<td>{% include "order/order_status.html" %}</td> <td>{% include "order/order_status.html" %}</td>
<td>{{ order.lines.count }}</td> <td>{{ order.lines.count }}</td>

View File

@ -92,7 +92,7 @@ $("#po-lines-table").on('click', ".line-receive", function() {
console.log('clicked! ' + button.attr('pk')); console.log('clicked! ' + button.attr('pk'));
launchModalForm("{% url 'purchase-order-receive' order.id %}", { launchModalForm("{% url 'po-receive' order.id %}", {
reload: true, reload: true,
data: { data: {
line: button.attr('pk') line: button.attr('pk')
@ -109,7 +109,7 @@ $("#po-lines-table").on('click', ".line-receive", function() {
}); });
$("#receive-order").click(function() { $("#receive-order").click(function() {
launchModalForm("{% url 'purchase-order-receive' order.id %}", { launchModalForm("{% url 'po-receive' order.id %}", {
reload: true, reload: true,
secondary: [ secondary: [
{ {
@ -123,13 +123,13 @@ $("#receive-order").click(function() {
}); });
$("#complete-order").click(function() { $("#complete-order").click(function() {
launchModalForm("{% url 'purchase-order-complete' order.id %}", { launchModalForm("{% url 'po-complete' order.id %}", {
reload: true, reload: true,
}); });
}); });
$("#export-order").click(function() { $("#export-order").click(function() {
location.href = "{% url 'purchase-order-export' order.id %}"; location.href = "{% url 'po-export' order.id %}";
}); });
{% if order.status == OrderStatus.PENDING %} {% if order.status == OrderStatus.PENDING %}

View File

@ -18,7 +18,7 @@ InvenTree | Purchase Orders
</div> </div>
</div> </div>
<table class='table table-striped table-condensed po-table' id='purchase-order-table'> <table class='table table-striped table-condensed po-table' data-toolbar='#table-buttons' id='purchase-order-table'>
</table> </table>
{% endblock %} {% endblock %}
@ -27,7 +27,7 @@ InvenTree | Purchase Orders
{{ block.super }} {{ block.super }}
$("#po-create").click(function() { $("#po-create").click(function() {
launchModalForm("{% url 'purchase-order-create' %}", launchModalForm("{% url 'po-create' %}",
{ {
follow: true, follow: true,
} }

View File

@ -2,12 +2,12 @@
<ul class='nav nav-tabs'> <ul class='nav nav-tabs'>
<li{% ifequal tab 'details' %} class='active'{% endifequal %}> <li{% ifequal tab 'details' %} class='active'{% endifequal %}>
<a href="{% url 'purchase-order-detail' order.id %}">{% trans "Items" %}</a> <a href="{% url 'po-detail' order.id %}">{% trans "Items" %}</a>
</li> </li>
<li{% if tab == 'attachments' %} class='active'{% endif %}> <li{% if tab == 'attachments' %} class='active'{% endif %}>
<a href="{% url 'purchase-order-attachments' order.id %}">{% trans "Attachments" %}</a> <a href="{% url 'po-attachments' order.id %}">{% trans "Attachments" %}</a>
</li> </li>
<li{% ifequal tab 'notes' %} class='active'{% endifequal %}> <li{% ifequal tab 'notes' %} class='active'{% endifequal %}>
<a href="{% url 'purchase-order-notes' order.id %}">{% trans "Notes" %}{% if order.notes %} <span class='glyphicon glyphicon-small glyphicon-info-sign'></span>{% endif %}</a> <a href="{% url 'po-notes' order.id %}">{% trans "Notes" %}{% if order.notes %} <span class='glyphicon glyphicon-small glyphicon-info-sign'></span>{% endif %}</a>
</li> </li>
</ul> </ul>

View File

@ -10,23 +10,24 @@ from django.conf.urls import url, include
from . import views from . import views
purchase_order_attachment_urls = [ 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<pk>\d+)/edit/', views.PurchaseOrderAttachmentEdit.as_view(), name='po-attachment-edit'),
] ]
purchase_order_detail_urls = [ purchase_order_detail_urls = [
url(r'^cancel/?', views.PurchaseOrderCancel.as_view(), name='purchase-order-cancel'), url(r'^cancel/?', views.PurchaseOrderCancel.as_view(), name='po-cancel'),
url(r'^edit/?', views.PurchaseOrderEdit.as_view(), name='purchase-order-edit'), url(r'^edit/?', views.PurchaseOrderEdit.as_view(), name='po-edit'),
url(r'^issue/?', views.PurchaseOrderIssue.as_view(), name='purchase-order-issue'), url(r'^issue/?', views.PurchaseOrderIssue.as_view(), name='po-issue'),
url(r'^receive/?', views.PurchaseOrderReceive.as_view(), name='purchase-order-receive'), url(r'^receive/?', views.PurchaseOrderReceive.as_view(), name='po-receive'),
url(r'^complete/?', views.PurchaseOrderComplete.as_view(), name='purchase-order-complete'), 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'^attachments/', views.PurchaseOrderDetail.as_view(template_name='order/po_attachments.html'), name='po-attachments'),
url(r'^.*$', views.PurchaseOrderDetail.as_view(), name='purchase-order-detail'), url(r'^.*$', views.PurchaseOrderDetail.as_view(), name='po-detail'),
] ]
po_line_item_detail_urls = [ po_line_item_detail_urls = [
@ -44,7 +45,7 @@ po_line_urls = [
purchase_order_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'), 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)), url(r'^attachments/', include(purchase_order_attachment_urls)),
# Display complete list of purchase orders # 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 = [ order_urls = [

View File

@ -117,7 +117,7 @@
{% if item.purchase_order %} {% if item.purchase_order %}
<tr> <tr>
<td>{% trans "Purchase Order" %}</td> <td>{% trans "Purchase Order" %}</td>
<td><a href="{% url 'purchase-order-detail' item.purchase_order.id %}">{{ item.purchase_order }}</a></td> <td><a href="{% url 'po-detail' item.purchase_order.id %}">{{ item.purchase_order }}</a></td>
</tr> </tr>
{% endif %} {% endif %}
{% if item.customer %} {% if item.customer %}

View File

@ -11,7 +11,7 @@
<li><a href="{% url 'stock-index' %}">{% trans "Stock" %}</a></li> <li><a href="{% url 'stock-index' %}">{% trans "Stock" %}</a></li>
<li><a href="{% url 'build-index' %}">{% trans "Build" %}</a></li> <li><a href="{% url 'build-index' %}">{% trans "Build" %}</a></li>
<li><a href="{% url 'company-index' %}">{% trans "Suppliers" %}</a></li> <li><a href="{% url 'company-index' %}">{% trans "Suppliers" %}</a></li>
<li><a href="{% url 'purchase-order-index' %}">{% trans "Orders" %}</a></li> <li><a href="{% url 'po-index' %}">{% trans "Orders" %}</a></li>
</ul> </ul>
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
{% include "search_form.html" %} {% include "search_form.html" %}