From 46ab6ef824bb42eba2410e852e3d0278eb379f97 Mon Sep 17 00:00:00 2001 From: David Date: Tue, 1 Oct 2024 13:37:10 +0200 Subject: [PATCH] fix(edi-import): Add description column only when more than two columns are available --- .../edi/doctype/code_list/code_list_import.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/erpnext/edi/doctype/code_list/code_list_import.js b/erpnext/edi/doctype/code_list/code_list_import.js index f3d0012e4974..ef14dc2cf77c 100644 --- a/erpnext/edi/doctype/code_list/code_list_import.js +++ b/erpnext/edi/doctype/code_list/code_list_import.js @@ -54,13 +54,6 @@ function show_column_selection_dialog(context) { ? "value" : null, }, - { - fieldname: "description_column", - label: __("as Description"), - fieldtype: "Select", - options: [null].concat(context.columns), - default: context.columns.includes("description") ? "description" : null, - }, { fieldname: "filters_column", label: __("Filter"), @@ -68,6 +61,16 @@ function show_column_selection_dialog(context) { }, ]; + if (context.columns.length > 2) { + fields.splice(5, 0, { + fieldname: "description_column", + label: __("as Description"), + fieldtype: "Select", + options: [null].concat(context.columns), + default: context.columns.includes("description") ? "description" : null, + }); + } + // Add filterable columns for (let column in context.filterable_columns) { fields.push({