fix: error if section is removed and saved
This commit is contained in:
parent
89fd754efc
commit
35a27101c1
@ -27,7 +27,9 @@ def get_fields_layout(doctype: str, type: str, parent_doctype: str | None = None
|
||||
if not tabs and type != "Required Fields":
|
||||
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:
|
||||
tabs = [{"name": "first_tab", "sections": tabs}]
|
||||
|
||||
@ -277,13 +277,13 @@ const fields = createResource({
|
||||
]
|
||||
let existingFields = []
|
||||
|
||||
for (let tab of props.tabs) {
|
||||
for (let section of tab.sections) {
|
||||
for (let column of section.columns) {
|
||||
props.tabs?.forEach((tab) => {
|
||||
tab.sections?.forEach((section) => {
|
||||
section.columns?.forEach((column) => {
|
||||
existingFields = existingFields.concat(column.fields)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
return data.filter((field) => {
|
||||
return (
|
||||
|
||||
@ -706,10 +706,10 @@ const dealTabs = createResource({
|
||||
auto: true,
|
||||
transform: (_tabs) => {
|
||||
let hasFields = false
|
||||
let parsedTabs = _tabs.forEach((tab) => {
|
||||
tab.sections.forEach((section) => {
|
||||
section.columns.forEach((column) => {
|
||||
column.fields.forEach((field) => {
|
||||
let parsedTabs = _tabs?.forEach((tab) => {
|
||||
tab.sections?.forEach((section) => {
|
||||
section.columns?.forEach((column) => {
|
||||
column.fields?.forEach((field) => {
|
||||
hasFields = true
|
||||
if (field.fieldname == 'status') {
|
||||
field.fieldtype = 'Select'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user