refactor(postgres): port Mode of Payment doctype queries to the query builder

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Mihir Kandoi
2026-06-17 18:38:00 +05:30
parent ac26c01e52
commit 588dfac4cd

View File

@@ -52,12 +52,11 @@ class ModeofPayment(Document):
def validate_pos_mode_of_payment(self): def validate_pos_mode_of_payment(self):
if not self.enabled: if not self.enabled:
pos_profiles = frappe.db.sql( pos_profiles = frappe.get_all(
"""SELECT sip.parent FROM `tabSales Invoice Payment` sip "Sales Invoice Payment",
WHERE sip.parenttype = 'POS Profile' and sip.mode_of_payment = %s""", filters={"parenttype": "POS Profile", "mode_of_payment": self.name},
(self.name), pluck="parent",
) )
pos_profiles = list(map(lambda x: x[0], pos_profiles))
if pos_profiles: if pos_profiles:
message = _( message = _(