fix: reconciliation issue due to notation difference

This commit is contained in:
ruthra kumar
2024-02-09 16:50:14 +05:30
parent 157d17d0f3
commit dcf19c3ed9

View File

@@ -10,7 +10,7 @@ import frappe.defaults
from frappe import _, qb, throw from frappe import _, qb, throw
from frappe.model.meta import get_field_precision from frappe.model.meta import get_field_precision
from frappe.query_builder import AliasedQuery, Criterion, Table from frappe.query_builder import AliasedQuery, Criterion, Table
from frappe.query_builder.functions import Sum from frappe.query_builder.functions import Round, Sum
from frappe.query_builder.utils import DocType from frappe.query_builder.utils import DocType
from frappe.utils import ( from frappe.utils import (
cint, cint,
@@ -549,16 +549,19 @@ def check_if_advance_entry_modified(args):
args, args,
) )
else: else:
ret = frappe.db.sql( pe = qb.DocType("Payment Entry")
"""select name from `tabPayment Entry` ret = (
where qb.from_(pe)
name = %(voucher_no)s and docstatus = 1 .select(pe.name)
and party_type = %(party_type)s and party = %(party)s and {0} = %(account)s .where(
and round(unallocated_amount, {1}) = round(%(unreconciled_amount)s, {1}) (pe.name == args.voucher_no)
""".format( & (pe.docstatus == 1)
party_account_field, precision & (pe.party_type == args.party_type)
), & (pe.party == args.party)
args, & (pe[party_account_field] == args.account)
& (Round(pe.unallocated_amount, precision) == Round(args.unreconciled_amount, precision))
)
.run()
) )
if not ret: if not ret: