mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Create a new supplier part directly from the order form
This commit is contained in:
parent
4be82a31ce
commit
915395e676
@ -37,7 +37,7 @@
|
||||
</td>
|
||||
<td>
|
||||
<button class='btn btn-default btn-create' id='new_supplier_part_{{ part.id }}' title='Create new supplier part for {{ part }}' type='button'>
|
||||
<span onClick='newSupplierPartFromWizard()' class='glyphicon glyphicon-small glyphicon-plus'></span>
|
||||
<span part-id='{{ part.id }}' onClick='newSupplierPartFromOrderWizard()' class='glyphicon glyphicon-small glyphicon-plus'></span>
|
||||
</button>
|
||||
</td>
|
||||
<td>
|
||||
|
@ -8,4 +8,33 @@ function removeOrderRowFromOrderWizard(e) {
|
||||
var row = $(src).attr('row');
|
||||
|
||||
$('#' + row).remove();
|
||||
}
|
||||
}
|
||||
|
||||
function newSupplierPartFromOrderWizard(e) {
|
||||
/* Create a new supplier part directly from an order form.
|
||||
* Launches a secondary modal and (if successful),
|
||||
* back-populates the selected row.
|
||||
*/
|
||||
|
||||
e = e || window.event;
|
||||
|
||||
var src = e.target || e.srcElement;
|
||||
|
||||
var part = $(src).attr('part-id');
|
||||
|
||||
launchModalForm("/supplier-part/new/", {
|
||||
modal: '#modal-form-secondary',
|
||||
data: {
|
||||
part: part,
|
||||
},
|
||||
success: function(response) {
|
||||
/* A new supplier part has been created! */
|
||||
|
||||
var dropdown = '#id_supplier_part_' + part;
|
||||
|
||||
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