diff --git a/InvenTree/templates/js/translated/forms.js b/InvenTree/templates/js/translated/forms.js index 88c9c5badb..e01835ae36 100644 --- a/InvenTree/templates/js/translated/forms.js +++ b/InvenTree/templates/js/translated/forms.js @@ -1780,6 +1780,11 @@ function initializeRelatedField(field, fields, options={}) { // Only a single result is available, given the provided filters if (data.count == 1) { setRelatedFieldData(name, data.results[0], options); + + // Run "callback" function (if supplied) + if (field.onEdit) { + field.onEdit(data.results[0], name, field, options); + } } } }); diff --git a/InvenTree/templates/js/translated/model_renderers.js b/InvenTree/templates/js/translated/model_renderers.js index e3abe1186f..72c1ed378b 100644 --- a/InvenTree/templates/js/translated/model_renderers.js +++ b/InvenTree/templates/js/translated/model_renderers.js @@ -371,10 +371,16 @@ function renderSupplierPart(name, data, parameters, options) { var html = ''; html += select2Thumbnail(supplier_image); - html += select2Thumbnail(part_image); + + if (data.part_detail) { + html += select2Thumbnail(part_image); + } html += ` ${data.supplier_detail.name} - ${data.SKU}`; - html += ` - ${data.part_detail.full_name}`; + + if (data.part_detail) { + html += ` - ${data.part_detail.full_name}`; + } html += `{% trans "Supplier Part ID" %}: ${data.pk}`;