diff --git a/InvenTree/order/templates/order/order_wizard/select_pos.html b/InvenTree/order/templates/order/order_wizard/select_pos.html
index bed01bbb5c..f97ba95ee2 100644
--- a/InvenTree/order/templates/order/order_wizard/select_pos.html
+++ b/InvenTree/order/templates/order/order_wizard/select_pos.html
@@ -42,7 +42,7 @@
id='new_po_{{ supplier.id }}'
title='Create new purchase order for {{ supplier.name }}'
type='button'>
-
+
diff --git a/InvenTree/order/templates/order/po_table.html b/InvenTree/order/templates/order/po_table.html
index 0c1149470f..cfd4811d97 100644
--- a/InvenTree/order/templates/order/po_table.html
+++ b/InvenTree/order/templates/order/po_table.html
@@ -4,6 +4,7 @@
| Order Reference |
Description |
Status |
+ Items |
{% for order in orders %}
@@ -11,6 +12,7 @@
{{ order }} |
{{ order.description }} |
{% include "order/order_status.html" %} |
+ {{ order.lines.count }} |
{% endfor %}
\ No newline at end of file
diff --git a/InvenTree/static/script/inventree/order.js b/InvenTree/static/script/inventree/order.js
index 79ac2b76bd..82e14532d6 100644
--- a/InvenTree/static/script/inventree/order.js
+++ b/InvenTree/static/script/inventree/order.js
@@ -38,3 +38,32 @@ function newSupplierPartFromOrderWizard(e) {
},
});
}
+
+function newPurchaseOrderFromOrderWizard(e) {
+ /* Create a new purchase order directly from an order form.
+ * Launches a secondary modal and (if successful),
+ * back-fills the newly created purchase order.
+ */
+
+ e = e || window.event;
+
+ var src = e.target || e.srcElement;
+
+ var supplier = $(src).attr('supplier-id');
+
+ launchModalForm("/order/purchase-order/new/", {
+ modal: '#modal-form-secondary',
+ data: {
+ supplier: supplier,
+ },
+ success: function(response) {
+ /* A new purchase order has been created! */
+
+ var dropdown = '#id-purchase-order-' + supplier;
+
+ var option = new Option(response.text, response.pk, true, true);
+
+ $('#modal-form').find(dropdown).append(option).trigger('change');
+ },
+ });
+}
\ No newline at end of file