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):
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 = _(