From 93021a9d45abbb91622d906d7a63f98b7627e9cb Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Wed, 17 Jun 2026 14:05:52 +0530 Subject: [PATCH] fix(postgres): satisfy strict GROUP BY in accounts advances service Co-Authored-By: Claude Opus 4.8 (1M context) --- erpnext/accounts/services/advances.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/services/advances.py b/erpnext/accounts/services/advances.py index 893ce4ff4f8..5ac759cf1fe 100644 --- a/erpnext/accounts/services/advances.py +++ b/erpnext/accounts/services/advances.py @@ -12,7 +12,7 @@ import frappe from frappe import _ from frappe.query_builder import Criterion from frappe.query_builder.custom import ConstantColumn -from frappe.query_builder.functions import Abs, Sum +from frappe.query_builder.functions import Abs, Max, Sum from frappe.utils import flt import erpnext @@ -150,7 +150,7 @@ def calculate_total_advance_from_ledger(doc) -> list: adv = frappe.qb.DocType("Advance Payment Ledger Entry") return ( frappe.qb.from_(adv) - .select(Abs(Sum(adv.amount)).as_("amount"), adv.currency.as_("account_currency")) + .select(Abs(Sum(adv.amount)).as_("amount"), Max(adv.currency).as_("account_currency")) .where(adv.company == doc.company) .where(adv.delinked == 0) .where(adv.against_voucher_type == doc.doctype)