From af69dab130e623ea16b35c7c0ac07bc0a7b7e322 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Thu, 29 Feb 2024 09:56:52 +0530 Subject: [PATCH] fix(UX): reload form after renaming field (#25159) --- .../custom/doctype/custom_field/custom_field.js | 16 +++++++++------- .../custom/doctype/custom_field/custom_field.py | 1 + 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/frappe/custom/doctype/custom_field/custom_field.js b/frappe/custom/doctype/custom_field/custom_field.js index d0c61b6d8c..c7c86c0077 100644 --- a/frappe/custom/doctype/custom_field/custom_field.js +++ b/frappe/custom/doctype/custom_field/custom_field.js @@ -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") diff --git a/frappe/custom/doctype/custom_field/custom_field.py b/frappe/custom/doctype/custom_field/custom_field.py index 9802839556..2d9fbe00f8 100644 --- a/frappe/custom/doctype/custom_field/custom_field.py +++ b/frappe/custom/doctype/custom_field/custom_field.py @@ -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()