Merge pull request #21504 from frappe/fix-autoincrement-link-web-form

fix(WebForm): auto-increment link field
This commit is contained in:
mergify[bot] 2023-06-28 06:48:45 +00:00 committed by GitHub
commit 2fa7f8350c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View file

@ -174,6 +174,15 @@ frappe.ui.form.ControlAutocomplete = class ControlAutoComplete extends frappe.ui
if (typeof options[0] === "string") {
options = options.map((o) => ({ label: o, value: o }));
}
options = options.map((o) => {
if (typeof o !== "string") {
o.label = o.label.toString();
o.value = o.value.toString();
}
return o;
});
return options;
}

View file

@ -631,7 +631,7 @@ def get_link_options(web_form_name, doctype, allow_read_on_all_link_options=Fals
if title_field and show_title_field_in_link:
return json.dumps(link_options, default=str)
else:
return "\n".join([doc.value for doc in link_options])
return "\n".join([str(doc.value) for doc in link_options])
else:
raise frappe.PermissionError(