From e920165901b79d35ea253d8e6de64af5a94c3e39 Mon Sep 17 00:00:00 2001 From: Oliver Date: Wed, 26 Jun 2024 12:48:03 +1000 Subject: [PATCH] Fix for BOM import (#7515) --- src/backend/InvenTree/templates/js/translated/forms.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/backend/InvenTree/templates/js/translated/forms.js b/src/backend/InvenTree/templates/js/translated/forms.js index 56ae5a2c3c..7b49cb5238 100644 --- a/src/backend/InvenTree/templates/js/translated/forms.js +++ b/src/backend/InvenTree/templates/js/translated/forms.js @@ -2248,11 +2248,12 @@ function initializeRelatedField(field, fields, options={}) { */ function setRelatedFieldData(name, data, options={}) { - var select = getFormFieldElement(name, options); + let select = getFormFieldElement(name, options); - const pkField = options?.fields[name]?.pk_field ?? 'pk'; + let fields = options?.fields ?? {}; + let pkField = fields[name]?.pk_field ?? 'pk'; - var option = new Option(name, data[pkField], true, true); + let option = new Option(name, data[pkField], true, true); // Assign the JSON data to the 'instance' attribute, // so we can access and render it later