From 811bed32c1f550b8c4e8ad4934b1839950c3b340 Mon Sep 17 00:00:00 2001 From: Aditya Hase Date: Wed, 5 Jun 2019 10:26:26 +0530 Subject: [PATCH] fix(naming): Limit number of docs to be renamed to 50000 per doctype (#17827) If total docs to be renamed goes over 100000 then the total number of writes exceed 200000 and check_transaction_status (database.py) raises a Validation Error This causes failure in the job being executed currently and every single job triggered afterwards. --- erpnext/accounts/doctype/gl_entry/gl_entry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/gl_entry/gl_entry.py b/erpnext/accounts/doctype/gl_entry/gl_entry.py index 4c617c727e..c543225444 100644 --- a/erpnext/accounts/doctype/gl_entry/gl_entry.py +++ b/erpnext/accounts/doctype/gl_entry/gl_entry.py @@ -281,7 +281,7 @@ def rename_gle_sle_docs(): def rename_temporarily_named_docs(doctype): """Rename temporarily named docs using autoname options""" - docs_to_rename = frappe.get_all(doctype, {"to_rename": "1"}, order_by="creation") + docs_to_rename = frappe.get_all(doctype, {"to_rename": "1"}, order_by="creation", limit=50000) for doc in docs_to_rename: oldname = doc.name set_name_from_naming_options(frappe.get_meta(doctype).autoname, doc)