From 588dfac4cd51f2b684462cc5cbaed0ce1bd44c2c Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Wed, 17 Jun 2026 18:38:00 +0530 Subject: [PATCH] refactor(postgres): port Mode of Payment doctype queries to the query builder Co-Authored-By: Claude Opus 4.8 (1M context) --- .../accounts/doctype/mode_of_payment/mode_of_payment.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.py b/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.py index 6fc9eba4c3f..388bccac844 100644 --- a/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.py +++ b/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.py @@ -52,12 +52,11 @@ class ModeofPayment(Document): def validate_pos_mode_of_payment(self): if not self.enabled: - pos_profiles = frappe.db.sql( - """SELECT sip.parent FROM `tabSales Invoice Payment` sip - WHERE sip.parenttype = 'POS Profile' and sip.mode_of_payment = %s""", - (self.name), + pos_profiles = frappe.get_all( + "Sales Invoice Payment", + filters={"parenttype": "POS Profile", "mode_of_payment": self.name}, + pluck="parent", ) - pos_profiles = list(map(lambda x: x[0], pos_profiles)) if pos_profiles: message = _(