From 1680da6f31d223ade70d282ed0fc912e39a75293 Mon Sep 17 00:00:00 2001 From: Ali <010109ali@gmail.com> Date: Mon, 7 Apr 2025 16:17:41 +0400 Subject: [PATCH] Added all field types to universal field modal --- .../doctype/formula_editor/formula_editor.js | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/formula_editor/formula_editor/doctype/formula_editor/formula_editor.js b/formula_editor/formula_editor/doctype/formula_editor/formula_editor.js index 082b338..ed01c9a 100644 --- a/formula_editor/formula_editor/doctype/formula_editor/formula_editor.js +++ b/formula_editor/formula_editor/doctype/formula_editor/formula_editor.js @@ -3100,22 +3100,28 @@ function openUniversalFieldModal(frm, fieldId = null) { return; } - // Фильтруем только числовые поля - const numericFields = meta.fields.filter(field => - ['Int', 'Float', 'Currency'].includes(field.fieldtype) + // Получаем все доступные поля, а не только числовые + const excluded_types = [ + "Tab Break", "Column Break", "Button", "Section Break", "Column Break", + "HTML", "Table", "Attach", "Attach Image", "Code", "Text Editor", "Image", + "Heading", "Fold", "Table MultiSelect" + ]; + + const availableFields = meta.fields.filter(field => + !excluded_types.includes(field.fieldtype) ); - if (numericFields.length === 0) { + if (availableFields.length === 0) { frappe.msgprint({ title: __('Предупреждение'), - message: __(`В DocType ${selectedDoctype} не найдено числовых полей`), + message: __(`В DocType ${selectedDoctype} не найдено подходящих полей`), indicator: 'orange' }); return; } // Обновляем опции для поля fieldname - const options = numericFields.map(field => ({ + const options = availableFields.map(field => ({ label: field.label || field.fieldname, value: field.fieldname })); @@ -3130,8 +3136,7 @@ function openUniversalFieldModal(frm, fieldId = null) { // Обновляем опции для поля фильтра const filterFieldOptions = meta.fields .filter(field => - ['Int', 'Float', 'Currency', 'Data', 'Text', 'Date', 'Datetime', - 'Check', 'Select', 'Link', 'Small Text', 'Read Only'].includes(field.fieldtype) + !excluded_types.includes(field.fieldtype) ) .map(field => ({ label: field.label || field.fieldname,