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 92403d51f44..090c0a59a67 100644 --- a/erpnext/setup/doctype/transaction_deletion_record/transaction_deletion_record.py +++ b/erpnext/setup/doctype/transaction_deletion_record/transaction_deletion_record.py @@ -318,12 +318,23 @@ class TransactionDeletionRecord(Document): Returns: list: List of child table DocType names (Table field options) """ - return frappe.get_all( + child_tables = frappe.get_all( "DocField", filters={"parent": doctype_name, "fieldtype": ["in", ["Table", "Table MultiSelect"]]}, pluck="options", ) + if not child_tables: + return [] + + child_tables = frappe.get_all( + "DocType", + filters={"name": ["in", child_tables], "is_virtual": 0}, + pluck="name", + ) + + return child_tables + def _get_to_delete_row_infos(self, doctype_name, company_field=None, company=None): """Get child tables and document count for a To Delete list row