1
0
forked from test/crm

Merge pull request #407 from tridz-dev/develop

Fix: Add null check for Select field options in fields_layout
This commit is contained in:
Shariq Ansari 2024-10-11 14:29:00 +05:30 committed by GitHub
commit 83d5b33a06
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -34,7 +34,7 @@ def get_fields_layout(doctype: str, type: str):
for field in section.get("fields") if section.get("fields") else []:
field = next((f for f in fields if f.fieldname == field), None)
if field:
if field.fieldtype == "Select":
if field.fieldtype == "Select" and field.options:
field.options = field.options.split("\n")
field.options = [{"label": _(option), "value": option} for option in field.options]
field.options.insert(0, {"label": "", "value": ""})