From 7ccd339b5c1b23808e2943747c690c3a48d4b6fd Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 11 Mar 2021 14:15:31 +1100 Subject: [PATCH] Print reports for multiple selected sales orders / purchase orders --- .../templates/order/purchase_orders.html | 42 +++++++++++----- .../order/templates/order/sales_orders.html | 50 ++++++++++++++----- InvenTree/templates/js/order.js | 10 ++-- 3 files changed, 74 insertions(+), 28 deletions(-) diff --git a/InvenTree/order/templates/order/purchase_orders.html b/InvenTree/order/templates/order/purchase_orders.html index 262f083074..6667cbd437 100644 --- a/InvenTree/order/templates/order/purchase_orders.html +++ b/InvenTree/order/templates/order/purchase_orders.html @@ -15,18 +15,24 @@ InvenTree | {% trans "Purchase Orders" %}
- {% if roles.purchase_order.add %} - - {% endif %} - - -
- +
+ {% if roles.purchase_order.add %} + + {% endif %} + + + +
+ +
@@ -154,6 +160,18 @@ $("#view-list").click(function() { $("#view-calendar").show(); }); +$("#order-print").click(function() { + var rows = $("#purchase-order-table").bootstrapTable('getSelections'); + + var orders = []; + + rows.forEach(function(row) { + orders.push(row.pk); + }); + + printPurchaseOrderReports(orders); +}) + $("#po-create").click(function() { launchModalForm("{% url 'po-create' %}", { diff --git a/InvenTree/order/templates/order/sales_orders.html b/InvenTree/order/templates/order/sales_orders.html index 257ee13887..6d4be9fff6 100644 --- a/InvenTree/order/templates/order/sales_orders.html +++ b/InvenTree/order/templates/order/sales_orders.html @@ -15,18 +15,24 @@ InvenTree | {% trans "Sales Orders" %}
- {% if roles.sales_order.add %} - - {% endif %} - - -
- +
+ {% if roles.sales_order.add %} + + {% endif %} + + + +
+ +
@@ -156,10 +162,30 @@ loadSalesOrderTable("#sales-order-table", { url: "{% url 'api-so-list' %}", }); +$("#order-print").click(function() { + var rows = $("#sales-order-table").bootstrapTable('getSelections'); + + var orders = []; + + rows.forEach(function(row) { + orders.push(row.pk); + }); + + printSalesOrderReports(orders); +}) + $("#so-create").click(function() { launchModalForm("{% url 'so-create' %}", { follow: true, + secondary: [ + { + field: 'customer', + label: '{% trans "New Customer" %}', + title: '{% trans "Create new Customer" %}', + url: '{% url "customer-create" %}', + } + ] } ); }); diff --git a/InvenTree/templates/js/order.js b/InvenTree/templates/js/order.js index 92b9db787c..39981226ca 100644 --- a/InvenTree/templates/js/order.js +++ b/InvenTree/templates/js/order.js @@ -139,8 +139,9 @@ function loadPurchaseOrderTable(table, options) { columns: [ { field: 'pk', - title: 'ID', - visible: false, + title: '', + visible: true, + checkbox: true, switchable: false, }, { @@ -235,8 +236,9 @@ function loadSalesOrderTable(table, options) { columns: [ { field: 'pk', - title: 'ID', - visible: false, + title: '', + checkbox: true, + visible: true, switchable: false, }, {