Add two new "build orders" tab to the "sales order" view

This commit is contained in:
Oliver Walters 2020-04-25 13:29:18 +10:00
parent d5f3498238
commit 66b6036827
4 changed files with 40 additions and 5 deletions

View File

@ -260,8 +260,6 @@ function setupFilterList(tableKey, table, target) {
var element = $(target);
console.log(tableKey + " - " + element);
// One blank slate, please
element.empty();
@ -302,8 +300,6 @@ function setupFilterList(tableKey, table, target) {
element.find(`#filter-tag-${tableKey}`).on('change', function() {
var list = element.find(`#filter-value-${tableKey}`);
console.log('index was changed!');
list.replaceWith(generateFilterInput(tableKey, this.value));
});

View File

@ -0,0 +1,30 @@
{% extends "order/sales_order_base.html" %}
{% load inventree_extras %}
{% load i18n %}
{% load static %}
{% block details %}
{% include 'order/so_tabs.html' with tab='builds' %}
<h4>{% trans "Build Orders" %}</h4>
<hr>
<table class='table table-striped table-condensed' id='builds-table'></table>
{% endblock %}
{% block js_ready %}
{{ block.super }}
loadBuildTable($("#builds-table"), {
url: "{% url 'api-build-list' %}",
params: {
sales_order: {{ order.id }},
part_detail: true,
},
});
{% endblock %}

View File

@ -2,7 +2,15 @@
<ul class='nav nav-tabs'>
<li{% ifequal tab 'details' %} class='active'{% endifequal %}>
<a href="{% url 'so-detail' order.id %}">{% trans "Items" %}</a>
<a href="{% url 'so-detail' order.id %}">{% trans "Order Items" %}</a>
</li>
<li{% if tab == 'builds' %} class='active'{% endif %}>
<a href="{% url 'so-builds' order.id %}">
{% trans "Build Orders" %}
{% if order.builds.count > 0 %}
<span class='badge'>{{ order.builds.count }}</span>
{% endif %}
</a>
</li>
<li{% if tab == 'attachments' %} class='active'{% endif %}>
<a href="{% url 'so-attachments' order.id %}">{% trans "Attachments" %}

View File

@ -58,6 +58,7 @@ sales_order_detail_urls = [
url(r'^cancel/', views.SalesOrderCancel.as_view(), name='so-cancel'),
url(r'^ship/', views.SalesOrderShip.as_view(), name='so-ship'),
url(r'^builds/', views.SalesOrderDetail.as_view(template_name='order/so_builds.html'), name='so-builds'),
url(r'^attachments/', views.SalesOrderDetail.as_view(template_name='order/so_attachments.html'), name='so-attachments'),
url(r'^notes/', views.SalesOrderNotes.as_view(), name='so-notes'),