Tweaks for existing form code

This commit is contained in:
Oliver Walters 2022-03-21 23:19:27 +11:00
parent 64bbcd2570
commit f2806b2e41
2 changed files with 13 additions and 2 deletions

View File

@ -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);
}
}
}
});

View File

@ -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 += ` <span><b>${data.supplier_detail.name}</b> - ${data.SKU}</span>`;
html += ` - <i>${data.part_detail.full_name}</i>`;
if (data.part_detail) {
html += ` - <i>${data.part_detail.full_name}</i>`;
}
html += `<span class='float-right'><small>{% trans "Supplier Part ID" %}: ${data.pk}</small></span>`;