From bb4b1bf9ccb5801d939050226dc8c8600651e601 Mon Sep 17 00:00:00 2001 From: Oliver Date: Fri, 17 Mar 2023 09:49:54 +1100 Subject: [PATCH] Catch potential errors when rendering manufacturerpart in form (#4501) --- InvenTree/templates/js/translated/model_renderers.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/InvenTree/templates/js/translated/model_renderers.js b/InvenTree/templates/js/translated/model_renderers.js index fb38e1345b..3e79482a81 100644 --- a/InvenTree/templates/js/translated/model_renderers.js +++ b/InvenTree/templates/js/translated/model_renderers.js @@ -399,8 +399,13 @@ function renderManufacturerPart(name, data, parameters={}, options={}) { html += select2Thumbnail(manufacturer_image); html += select2Thumbnail(part_image); - html += ` ${data.manufacturer_detail.name} - ${data.MPN}`; - html += ` - ${data.part_detail.full_name}`; + if (data.manufacturer_detail) { + html += ` ${data.manufacturer_detail.name} - ${data.MPN}`; + } + + if (data.part_detail) { + html += ` - ${data.part_detail.full_name}`; + } html += renderId('{% trans "Manufacturer Part ID" %}', data.pk, parameters);