fix: commit individual SLE rename for large datasets (#25084)

This commit is contained in:
Rohan 2021-03-31 15:22:00 +05:30 committed by GitHub
parent 0586b7db79
commit 99a8cb7143
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -290,4 +290,8 @@ def rename_temporarily_named_docs(doctype):
oldname = doc.name
set_name_from_naming_options(frappe.get_meta(doctype).autoname, doc)
newname = doc.name
frappe.db.sql("""UPDATE `tab{}` SET name = %s, to_rename = 0 where name = %s""".format(doctype), (newname, oldname))
frappe.db.sql(
"UPDATE `tab{}` SET name = %s, to_rename = 0 where name = %s".format(doctype),
(newname, oldname),
auto_commit=True
)