From b5735531c15521c411d441e72f8ca08e1e23e344 Mon Sep 17 00:00:00 2001 From: Diptanil Saha Date: Tue, 30 Jun 2026 21:46:03 +0530 Subject: [PATCH] refactor: port bulk_transaction_log existence check to the query builder (#56667) Co-authored-by: Mihir Kandoi Co-authored-by: Claude Opus 4.8 (1M context) --- .../doctype/bulk_transaction_log/bulk_transaction_log.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/erpnext/bulk_transaction/doctype/bulk_transaction_log/bulk_transaction_log.py b/erpnext/bulk_transaction/doctype/bulk_transaction_log/bulk_transaction_log.py index fbe9d7fcf7d..6ffb23659c8 100644 --- a/erpnext/bulk_transaction/doctype/bulk_transaction_log/bulk_transaction_log.py +++ b/erpnext/bulk_transaction/doctype/bulk_transaction_log/bulk_transaction_log.py @@ -30,10 +30,7 @@ class BulkTransactionLog(Document): def load_from_db(self): log_detail = qb.DocType("Bulk Transaction Log Detail") - has_records = frappe.db.sql( - "select exists (select * from `tabBulk Transaction Log Detail` where date = %s);", - (self.name,), - )[0][0] + has_records = frappe.db.exists("Bulk Transaction Log Detail", {"date": self.name}) if not has_records: raise frappe.DoesNotExistError