Merge pull request #811 from shariquerik/required-field-modal-fix

This commit is contained in:
Shariq Ansari 2025-05-12 11:30:32 +05:30 committed by GitHub
commit d74ff9ab62
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 11 deletions

View File

@ -27,7 +27,9 @@ def get_fields_layout(doctype: str, type: str, parent_doctype: str | None = None
if not tabs and type != "Required Fields": if not tabs and type != "Required Fields":
tabs = get_default_layout(doctype) tabs = get_default_layout(doctype)
has_tabs = tabs[0].get("sections") if tabs and tabs[0] else False has_tabs = False
if isinstance(tabs, list) and len(tabs) > 0 and isinstance(tabs[0], dict):
has_tabs = any("sections" in tab for tab in tabs)
if not has_tabs: if not has_tabs:
tabs = [{"name": "first_tab", "sections": tabs}] tabs = [{"name": "first_tab", "sections": tabs}]

View File

@ -277,13 +277,13 @@ const fields = createResource({
] ]
let existingFields = [] let existingFields = []
for (let tab of props.tabs) { props.tabs?.forEach((tab) => {
for (let section of tab.sections) { tab.sections?.forEach((section) => {
for (let column of section.columns) { section.columns?.forEach((column) => {
existingFields = existingFields.concat(column.fields) existingFields = existingFields.concat(column.fields)
} })
} })
} })
return data.filter((field) => { return data.filter((field) => {
return ( return (

View File

@ -706,10 +706,10 @@ const dealTabs = createResource({
auto: true, auto: true,
transform: (_tabs) => { transform: (_tabs) => {
let hasFields = false let hasFields = false
let parsedTabs = _tabs.forEach((tab) => { let parsedTabs = _tabs?.forEach((tab) => {
tab.sections.forEach((section) => { tab.sections?.forEach((section) => {
section.columns.forEach((column) => { section.columns?.forEach((column) => {
column.fields.forEach((field) => { column.fields?.forEach((field) => {
hasFields = true hasFields = true
if (field.fieldname == 'status') { if (field.fieldname == 'status') {
field.fieldtype = 'Select' field.fieldtype = 'Select'