Merge pull request #49893 from frappe/mergify/bp/version-15-hotfix/pr-49829

fix: Set paid amount automatically only if return entry validated and has negative grand total (backport #49829)
This commit is contained in:
ruthra kumar
2025-10-06 12:58:33 +05:30
committed by GitHub
2 changed files with 9 additions and 8 deletions

View File

@@ -76,9 +76,10 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments {
// Update paid amount on return/debit note creation
if (
this.frm.doc.doctype === "Purchase Invoice"
&& this.frm.doc.is_return
&& (this.frm.doc.grand_total > this.frm.doc.paid_amount)
this.frm.doc.doctype === "Purchase Invoice" &&
this.frm.doc.is_return &&
this.frm.doc.grand_total < 0 &&
this.frm.doc.grand_total > this.frm.doc.paid_amount
) {
this.frm.doc.paid_amount = flt(this.frm.doc.grand_total, precision("grand_total"));
}