Catch potential errors when rendering manufacturerpart in form (#4501)

This commit is contained in:
Oliver 2023-03-17 09:49:54 +11:00 committed by GitHub
parent a0352f9eb6
commit bb4b1bf9cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -399,8 +399,13 @@ function renderManufacturerPart(name, data, parameters={}, options={}) {
html += select2Thumbnail(manufacturer_image);
html += select2Thumbnail(part_image);
html += ` <span><b>${data.manufacturer_detail.name}</b> - ${data.MPN}</span>`;
html += ` - <i>${data.part_detail.full_name}</i>`;
if (data.manufacturer_detail) {
html += ` <span><b>${data.manufacturer_detail.name}</b> - ${data.MPN}</span>`;
}
if (data.part_detail) {
html += ` - <i>${data.part_detail.full_name}</i>`;
}
html += renderId('{% trans "Manufacturer Part ID" %}', data.pk, parameters);