Rename document using script for user document

image

frappe.rename_doc() is given this error when i rename user using script. I alos tried ignore_permissions=True but still that is not work and also all permission is given for that user to update User document

Open the console log and check the error. so find the code what is saying, Then you will know where the actual issue is.

@NCP

File “apps/frappe/frappe/core/doctype/user/user.py”, line 633, in after_rename
frappe.rename_doc(“Notification Settings”, old_name, new_name, force=True, show_alert=False)
File “apps/frappe/frappe/utils/typing_validations.py”, line 31, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File “apps/frappe/frappe/init.py”, line 1469, in rename_doc
return rename_doc(
^^^^^^^^^^^
File “apps/frappe/frappe/model/rename_doc.py”, line 164, in rename_doc
new = validate_rename(
^^^^^^^^^^^^^^^^
File “apps/frappe/frappe/model/rename_doc.py”, line 383, in validate_rename
frappe.throw(_(“You need write permission to rename”))
File “apps/frappe/frappe/init.py”, line 652, in throw
msgprint(
File “apps/frappe/frappe/init.py”, line 617, in msgprint
_raise_exception()
File “apps/frappe/frappe/init.py”, line 568, in _raise_exception
raise exc
frappe.exceptions.ValidationError: You need write permission to rename

Does the login user have the Member Master role? check it.

Yes logged in through member master role and rename another user document

Also, check user has write access to Notification Settings? because it’s rename in the Notification Settings.

Yes @NCP

So it should work. You have to debug and check where the issue occurs