refactor: reorder flags in Tasks section
diff --git a/erpnext/setup/doctype/transaction_deletion_record/transaction_deletion_record.json b/erpnext/setup/doctype/transaction_deletion_record/transaction_deletion_record.json
index 6a84841..dc35fe5 100644
--- a/erpnext/setup/doctype/transaction_deletion_record/transaction_deletion_record.json
+++ b/erpnext/setup/doctype/transaction_deletion_record/transaction_deletion_record.json
@@ -14,8 +14,8 @@
   "delete_leads_and_addresses",
   "reset_company_default_values",
   "clear_notifications",
-  "delete_transactions",
   "initialize_doctypes_table",
+  "delete_transactions",
   "section_break_tbej",
   "doctypes",
   "doctypes_to_be_ignored",
@@ -123,7 +123,7 @@
  "index_web_pages_for_search": 1,
  "is_submittable": 1,
  "links": [],
- "modified": "2024-02-03 20:48:34.107577",
+ "modified": "2024-02-04 08:09:26.784109",
  "modified_by": "Administrator",
  "module": "Setup",
  "name": "Transaction Deletion Record",
diff --git a/erpnext/setup/doctype/transaction_deletion_record/transaction_deletion_record.py b/erpnext/setup/doctype/transaction_deletion_record/transaction_deletion_record.py
index 5a5a827..96e5bf9 100644
--- a/erpnext/setup/doctype/transaction_deletion_record/transaction_deletion_record.py
+++ b/erpnext/setup/doctype/transaction_deletion_record/transaction_deletion_record.py
@@ -170,7 +170,7 @@
 
 			tables = self.get_all_child_doctypes()
 			for docfield in self.doctypes:
-				if docfield.doctype_name != self.doctype:
+				if docfield.doctype_name != self.doctype and not docfield.done:
 					no_of_docs = self.get_number_of_docs_linked_with_specified_company(
 						docfield.doctype_name, docfield.docfield_name
 					)
@@ -193,6 +193,9 @@
 						if naming_series:
 							if "#" in naming_series:
 								self.update_naming_series(naming_series, docfield.doctype_name)
+
+					else:
+						frappe.db.set_value(docfield.doctype, docfield.name, "done", 1)
 			self.db_set("delete_transactions", 1)
 
 	def get_doctypes_to_be_ignored_list(self):