From 8a665709d2729781d2d3eb5aa96b2391964a2034 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Wed, 24 Jun 2026 14:38:52 +0530 Subject: [PATCH] fix: exclude virtual child doctypes from deletion in transaction deletion record (cherry picked from commit 8bd8b28207e8fd7e179cb6afc9a7d38a57c2e9f1) --- .../transaction_deletion_record.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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