Skip to content

Commit d882624

Browse files
committed
fix: update aggregation logic in sales invoice migration to use Max for account selection
1 parent 1360afe commit d882624

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

erpnext/patches/v16_0/migrate_tax_withholding_data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
import frappe
2323
from frappe.query_builder import Case
24-
from frappe.query_builder.functions import IfNull, Sum
24+
from frappe.query_builder.functions import IfNull, Max, Sum
2525
from frappe.utils import flt, now
2626

2727

@@ -913,7 +913,7 @@ def migrate_sales_invoices(tds_accounts, tax_rate_map, column_cache, party_tax_i
913913
Sum(Case().when(gle.account.isin(tcs_accounts_list), gle.credit - gle.debit).else_(0)).as_(
914914
"total_tcs"
915915
),
916-
Case().when(gle.account.isin(tcs_accounts_list), gle.account).else_(None).as_("account"),
916+
Max(Case().when(gle.account.isin(tcs_accounts_list), gle.account).else_(None)).as_("account"),
917917
)
918918
.where(si.docstatus == 1)
919919
.groupby(si.name)

0 commit comments

Comments
 (0)