fix: partial rename while replacing abbreviation (#27065)

diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py
index 45d5ce0..6dee2ad 100644
--- a/erpnext/setup/doctype/company/company.py
+++ b/erpnext/setup/doctype/company/company.py
@@ -423,11 +423,11 @@
 			_rename_record(d)
 	try:
 		frappe.db.auto_commit_on_many_writes = 1
-		frappe.db.set_value("Company", company, "abbr", new)
 		for dt in ["Warehouse", "Account", "Cost Center", "Department",
 				"Sales Taxes and Charges Template", "Purchase Taxes and Charges Template"]:
 			_rename_records(dt)
 			frappe.db.commit()
+		frappe.db.set_value("Company", company, "abbr", new)
 
 	except Exception:
 		frappe.log_error(title=_('Abbreviation Rename Error'))