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
InvenTree
@ -42,7 +42,7 @@
|
|||||||
id='new_po_{{ supplier.id }}'
|
id='new_po_{{ supplier.id }}'
|
||||||
title='Create new purchase order for {{ supplier.name }}'
|
title='Create new purchase order for {{ supplier.name }}'
|
||||||
type='button'>
|
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>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
<th data-field='reference'>Order Reference</th>
|
<th data-field='reference'>Order Reference</th>
|
||||||
<th data-field='description'>Description</th>
|
<th data-field='description'>Description</th>
|
||||||
<th data-field='status'>Status</th>
|
<th data-field='status'>Status</th>
|
||||||
|
<th data-field='items'>Items</th>
|
||||||
</tr>
|
</tr>
|
||||||
{% for order in orders %}
|
{% for order in orders %}
|
||||||
<tr>
|
<tr>
|
||||||
@ -11,6 +12,7 @@
|
|||||||
<td><a href="{% url 'purchase-order-detail' order.id %}">{{ order }}</a></td>
|
<td><a href="{% url 'purchase-order-detail' order.id %}">{{ order }}</a></td>
|
||||||
<td>{{ order.description }}</td>
|
<td>{{ order.description }}</td>
|
||||||
<td>{% include "order/order_status.html" %}</td>
|
<td>{% include "order/order_status.html" %}</td>
|
||||||
|
<td>{{ order.lines.count }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</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