fix(UX): reload form after renaming field (#25159)

This commit is contained in:
Ankush Menat 2024-02-29 09:56:52 +05:30 committed by GitHub
parent a15ddf8d1b
commit af69dab130
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 7 deletions

View file

@ -123,13 +123,15 @@ frappe.ui.form.on("Custom Field", {
default: frm.doc.fieldname,
},
function (data) {
frappe.call({
method: "frappe.custom.doctype.custom_field.custom_field.rename_fieldname",
args: {
custom_field: frm.doc.name,
fieldname: data.fieldname,
},
});
frappe
.xcall(
"frappe.custom.doctype.custom_field.custom_field.rename_fieldname",
{
custom_field: frm.doc.name,
fieldname: data.fieldname,
}
)
.then(() => frm.reload());
},
__("Rename Fieldname"),
__("Rename")

View file

@ -370,6 +370,7 @@ def rename_fieldname(custom_field: str, fieldname: str):
field.db_set("fieldname", field.fieldname, notify=True)
_update_fieldname_references(field, old_fieldname, new_fieldname)
frappe.msgprint(_("Custom field renamed to {0} successfully.").format(fieldname), alert=True)
frappe.db.commit()
frappe.clear_cache()