fix: validate payment request total of partly paid invoice

(cherry picked from commit 899c18df18)
This commit is contained in:
Sugesh393
2025-02-05 11:00:55 +05:30
committed by Mergify
parent f6047d8491
commit c8881a9358

View File

@@ -775,7 +775,10 @@ def get_existing_paid_amount(doctype, name):
frappe.qb.from_(PL) frappe.qb.from_(PL)
.left_join(PER) .left_join(PER)
.on( .on(
(PER.reference_doctype == PL.against_voucher_type) & (PER.reference_name == PL.against_voucher_no) (PL.against_voucher_type == PER.reference_doctype)
& (PL.against_voucher_no == PER.reference_name)
& (PL.voucher_type == PER.parenttype)
& (PL.voucher_no == PER.parent)
) )
.select(Abs(Sum(PL.amount)).as_("total_paid_amount")) .select(Abs(Sum(PL.amount)).as_("total_paid_amount"))
.where(PL.against_voucher_type.eq(doctype)) .where(PL.against_voucher_type.eq(doctype))