mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Create a new purchase order directly from the "Order Parts" form wizard
This commit is contained in:
parent
915395e676
commit
f52aa0af21
@ -42,7 +42,7 @@
|
||||
id='new_po_{{ supplier.id }}'
|
||||
title='Create new purchase order for {{ supplier.name }}'
|
||||
type='button'>
|
||||
<span onclick='newPurchaseOrderFromWizard()' class='glyphicon glyphicon-small glyphicon-plus'></span>
|
||||
<span supplier-id='{{ supplier.id }}' onclick='newPurchaseOrderFromOrderWizard()' class='glyphicon glyphicon-small glyphicon-plus'></span>
|
||||
</button>
|
||||
</td>
|
||||
<td>
|
||||
|
@ -4,6 +4,7 @@
|
||||
<th data-field='reference'>Order Reference</th>
|
||||
<th data-field='description'>Description</th>
|
||||
<th data-field='status'>Status</th>
|
||||
<th data-field='items'>Items</th>
|
||||
</tr>
|
||||
{% for order in orders %}
|
||||
<tr>
|
||||
@ -11,6 +12,7 @@
|
||||
<td><a href="{% url 'purchase-order-detail' order.id %}">{{ order }}</a></td>
|
||||
<td>{{ order.description }}</td>
|
||||
<td>{% include "order/order_status.html" %}</td>
|
||||
<td>{{ order.lines.count }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
@ -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');
|
||||
},
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue
Block a user