diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py index 4d0888f078e..e03db121473 100644 --- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py +++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py @@ -765,6 +765,14 @@ class PaymentReconciliation(Document): def reconcile_dr_cr_note(dr_cr_notes, company, active_dimensions=None): for inv in dr_cr_notes: + if ( + abs(frappe.db.get_value(inv.voucher_type, inv.voucher_no, "outstanding_amount")) + < inv.allocated_amount + ): + frappe.throw( + _("{0} has been modified after you pulled it. Please pull it again.").format(inv.voucher_type) + ) + voucher_type = "Credit Note" if inv.voucher_type == "Sales Invoice" else "Debit Note" reconcile_dr_or_cr = (