Repository: frappe/frappe

Issue:
Document Renaming Error
when i am renaming document this error shows and not changing (this happening in "Print Format" and "Item Group" doctype)

![image](https://github.com/frappe/frappe/assets/135511086/dc768ec9-85e0-4d7e-9005-68e9a798537d)



```
Traceback (most recent call last):
12:12:47 web.1         |   File "apps/frappe/frappe/model/document.py", line 1520, in queue_action
12:12:47 web.1         |     self.lock()
12:12:47 web.1         |   File "apps/frappe/frappe/model/document.py", line 1574, in lock
12:12:47 web.1         |     raise frappe.DocumentLockedError
12:12:47 web.1         | frappe.exceptions.DocumentLockedError
12:12:47 web.1         | 
12:12:47 web.1         | During handling of the above exception, another exception occurred:
12:12:47 web.1         | 
12:12:47 web.1         | Traceback (most recent call last):
12:12:47 web.1         |   File "apps/frappe/frappe/app.py", line 110, in application
12:12:47 web.1         |     response = frappe.api.handle(request)
12:12:47 web.1         |   File "apps/frappe/frappe/api/__init__.py", line 49, in handle
12:12:47 web.1         |     data = endpoint(**arguments)
12:12:47 web.1         |   File "apps/frappe/frappe/api/v1.py", line 36, in handle_rpc_call
12:12:47 web.1         |     return frappe.handler.handle()
12:12:47 web.1         |   File "apps/frappe/frappe/handler.py", line 49, in handle
12:12:47 web.1         |     data = execute_cmd(cmd)
12:12:47 web.1         |   File "apps/frappe/frappe/handler.py", line 85, in execute_cmd
12:12:47 web.1         |     return frappe.call(method, **frappe.form_dict)
12:12:47 web.1         |   File "apps/frappe/frappe/__init__.py", line 1761, in call
12:12:47 web.1         |     return fn(*args, **newargs)
12:12:47 web.1         |   File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
12:12:47 web.1         |     return func(*args, **kwargs)
12:12:47 web.1         |   File "apps/frappe/frappe/model/rename_doc.py", line 89, in update_document_title
12:12:47 web.1         |     doc.queue_action("rename", name=transformed_name, merge=merge, queue=queue)
12:12:47 web.1         |   File "apps/frappe/frappe/model/document.py", line 1535, in queue_action
12:12:47 web.1         |     frappe.throw(
12:12:47 web.1         |   File "apps/frappe/frappe/__init__.py", line 645, in throw
12:12:47 web.1         |     msgprint(
12:12:47 web.1         |   File "apps/frappe/frappe/__init__.py", line 610, in msgprint
12:12:47 web.1         |     _raise_exception()
12:12:47 web.1         |   File "apps/frappe/frappe/__init__.py", line 561, in _raise_exception
12:12:47 web.1         |     raise exc
12:12:47 web.1         | frappe.exceptions.ValidationError: This document is currently locked and queued for execution. Please try again after some time.
```

------------------------------------------------------------------------------------------------------------------

after bench restart i am getting Error with button

![image](https://github.com/frappe/frappe/assets/135511086/bf3db757-5067-4d1f-95fe-5353dc0b4054)

and when i am click on it will show another error

![image](https://github.com/frappe/frappe/assets/135511086/cc7c258f-17f3-4e55-9c8d-440bb22ab732)



### Route
```
Form/Print Format/Dispatch Labels Mulptiple
```
### Traceback
```
Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 110, in application
    response = frappe.api.handle(request)
  File "apps/frappe/frappe/api/__init__.py", line 49, in handle
    data = endpoint(**arguments)
  File "apps/frappe/frappe/api/v1.py", line 36, in handle_rpc_call
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 49, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 85, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1761, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1742, in unlock_document
    doctype = str(args["doctype"])
TypeError: string indices must be integers

```
### Request Data
```
{
	"type": "POST",
	"args": {
		"args": "{\"doctype\":\"Print Format\",\"name\":\"Dispatch Labels Mulptiple\"}"
	},
	"headers": {},
	"error_handlers": {},
	"url": "/api/method/frappe.model.document.unlock_document",
	"request_id": null
}
```
### Response Data
```
{
	"exception": "TypeError: string indices must be integers",
	"exc_type": "TypeError"
}
```


Discussion:
i think this is because of when document renaming is in que , i tried again to rename it, this process locked document permanently, then we can not edit any field in that document
Please include some more details as per the template, such as the version you're running.
ERPNext: v15.22.0 (version-15)

Frappe Framework: v15.25.0 (version-15)

Resolving patch:
diff --git a/frappe/model/document.py b/frappe/model/document.py
--- a/frappe/model/document.py
+++ b/frappe/model/document.py
@@ -1627,8 +1627,9 @@ def execute_action(__doctype, __name, __action, **kwargs):
 
 @frappe.whitelist()
 def unlock_document(doctype: str | None = None, name: str | None = None, args=None):
+	# Backward compatibility
 	if not doctype and not name and args:
-		# Backward compatibility
+		args = json.loads(args)
 		doctype = str(args["doctype"])
 		name = str(args["name"])
 	frappe.get_doc(doctype, name).unlock()


Test patch: