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.
This commit is contained in:
Aditya Hase 2019-06-05 10:26:26 +05:30 committed by Nabin Hait
parent 4cb1a1e2e3
commit 811bed32c1

View File

@ -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)