fix(transaction-deletion): Add virtual doctypes to the list of ignored doctypes (backport #51063) (#51086)

* fix: Add virtual doctypes to the list of ignored doctypes in transaction deletion

(cherry picked from commit c7a7cb2b90)

* refactor: switch to `or_filters` so the query hits the DB only once

(cherry picked from commit 45a7195abe)

* refactor: remove redundant assignment of doctypes_to_be_ignored_list

(cherry picked from commit 0f7d89f4d1)

---------

Co-authored-by: KerollesFathy <kerollesfhabib@gmail.com>
This commit is contained in:
mergify[bot]
2025-12-14 14:31:02 +05:30
committed by GitHub
parent 6f6cbb717e
commit 67c0d08569

View File

@@ -309,8 +309,9 @@ class TransactionDeletionRecord(Document):
self.db_set("error_log", None)
def get_doctypes_to_be_ignored_list(self):
singles = frappe.get_all("DocType", filters={"issingle": 1}, pluck="name")
doctypes_to_be_ignored_list = singles
doctypes_to_be_ignored_list = frappe.get_all(
"DocType", or_filters=[["issingle", "=", 1], ["is_virtual", "=", 1]], pluck="name"
)
for doctype in self.doctypes_to_be_ignored:
doctypes_to_be_ignored_list.append(doctype.doctype_name)