fix: exclude virtual child doctypes from deletion in transaction deletion record

(cherry picked from commit 8bd8b28207)
This commit is contained in:
Mihir Kandoi
2026-06-24 14:38:52 +05:30
committed by Mergify
parent 54c45d7b22
commit 8a665709d2

View File

@@ -318,12 +318,23 @@ class TransactionDeletionRecord(Document):
Returns: Returns:
list: List of child table DocType names (Table field options) list: List of child table DocType names (Table field options)
""" """
return frappe.get_all( child_tables = frappe.get_all(
"DocField", "DocField",
filters={"parent": doctype_name, "fieldtype": ["in", ["Table", "Table MultiSelect"]]}, filters={"parent": doctype_name, "fieldtype": ["in", ["Table", "Table MultiSelect"]]},
pluck="options", 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): 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 """Get child tables and document count for a To Delete list row