Add page for displaying all sales orders

This commit is contained in:
Oliver Walters 2020-04-20 20:40:45 +10:00
parent 627c50e465
commit 1ebf26ab7c
6 changed files with 60 additions and 5 deletions

View File

@ -27,7 +27,10 @@
{{ block.super }} {{ block.super }}
loadPurchaseOrderTable("#purchase-order-table", { loadPurchaseOrderTable("#purchase-order-table", {
url: "{% url 'api-po-list' %}?supplier={{ company.id }}", url: "{% url 'api-po-list' %}",
params: {
supplier: company.id,
}
}); });

View File

@ -27,7 +27,10 @@
{{ block.super }} {{ block.super }}
loadSalesOrderTable("#sales-order-table", { loadSalesOrderTable("#sales-order-table", {
url: "{% url 'api-so-list' %}?customer={{ company.id }}", url: "{% url 'api-so-list' %}",
params: {
customer: {{ company.id }},
}
}); });

View File

@ -4,17 +4,17 @@
{% load i18n %} {% load i18n %}
{% block page_title %} {% block page_title %}
InvenTree | Purchase Orders InvenTree | {% trans "Purchase Orders" %}
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<h3>Purchase Orders</h3> <h3>{% trans "Purchase Orders" %}</h3>
<hr> <hr>
<div id='table-buttons'> <div id='table-buttons'>
<div class='button-toolbar container-fluid' style='float: right;'> <div class='button-toolbar container-fluid' style='float: right;'>
<button class='btn btn-primary' type='button' id='po-create' title='Create new purchase order'>New Purchase Order</button> <button class='btn btn-primary' type='button' id='po-create' title='{% trans "Create new purchase order" %}'>{% trans "New Purchase Order" %}</button>
<div class='filter-list' id='filter-list-order'> <div class='filter-list' id='filter-list-order'>
<!-- An empty div in which the filter list will be constructed --> <!-- An empty div in which the filter list will be constructed -->
</div> </div>

View File

@ -0,0 +1,36 @@
{% extends "base.html" %}
{% load static %}
{% load i18n %}
{% block page_title %}
InvenTree | {% trans "Sales Orders" %}
{% endblock %}
{% block content %}
<h3>{% trans "Sales Orders" %}</h3>
<hr>
<div id='table-buttons'>
<div class='button-toolbar container-fluid' style='float: right;'>
<button class='btn btn-primary' type='button' id='so-create' title='{% trans "Create new sales order" %}'>{% trans "New Sales Order" %}</button>
<div class='filter-list' id='filter-list-order'>
<!-- An empty div in which the filter list will be constructed -->
</div>
</div>
</div>
<table class='table table-striped table-condensed po-table' data-toolbar='#table-buttons' id='sales-order-table'>
</table>
{% endblock %}
{% block js_ready %}
{{ block.super }}
loadSalesOrderTable("#sales-order-table", {
url: "{% url 'api-so-list' %}",
});
{% endblock %}

View File

@ -61,6 +61,11 @@ purchase_order_urls = [
url(r'^.*$', views.PurchaseOrderIndex.as_view(), name='po-index'), url(r'^.*$', views.PurchaseOrderIndex.as_view(), name='po-index'),
] ]
sales_order_urls = [
url(r'^.*$', views.SalesOrderIndex.as_view(), name='so-index'),
]
order_urls = [ order_urls = [
url(r'^purchase-order/', include(purchase_order_urls)), url(r'^purchase-order/', include(purchase_order_urls)),
url(r'^sales-order/', include(sales_order_urls)),
] ]

View File

@ -16,6 +16,7 @@ import logging
from decimal import Decimal, InvalidOperation from decimal import Decimal, InvalidOperation
from .models import PurchaseOrder, PurchaseOrderLineItem, PurchaseOrderAttachment from .models import PurchaseOrder, PurchaseOrderLineItem, PurchaseOrderAttachment
from .models import SalesOrder, SalesOrderLineItem, SalesOrderAttachment
from .admin import POLineItemResource from .admin import POLineItemResource
from build.models import Build from build.models import Build
from company.models import Company, SupplierPart from company.models import Company, SupplierPart
@ -55,6 +56,13 @@ class PurchaseOrderIndex(ListView):
return ctx return ctx
class SalesOrderIndex(ListView):
model = SalesOrder
template_name = 'order/sales_orders.html'
context_object_name = 'orders'
class PurchaseOrderDetail(DetailView): class PurchaseOrderDetail(DetailView):
""" Detail view for a PurchaseOrder object """ """ Detail view for a PurchaseOrder object """