Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions av_tools/utils/create_custom_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ def create_fields_from_json(custom_fields_obj):
field_name: custom_field.get(field_name) for field_name in field_list
}

# Ensure module exists to avoid LinkValidationError
module_name = custom_field_dict.get("module")
if module_name and not frappe.db.exists("Module Def", module_name):
frappe.get_doc({
"doctype": "Module Def",
"module_name": module_name,
"app_name": "av_tools"
}).insert(ignore_permissions=True)

doctype_custom_fields_dict.setdefault(doctype, []).append(custom_field_dict)

create_custom_fields(doctype_custom_fields_dict, update=True)
Expand Down
Loading