fix: don't set default payment amount in case of invoice return (backport #35645) (#35647)
fix: don't set default payment amount in case of invoice return (#35645)
(cherry picked from commit 79483cc90eb71fa82d645b2cf54d9731502cf6c7)
Co-authored-by: Anand Baburajan <anandbaburajan@gmail.com>
diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js
index fd961c4..6f4e602 100644
--- a/erpnext/public/js/controllers/taxes_and_totals.js
+++ b/erpnext/public/js/controllers/taxes_and_totals.js
@@ -805,11 +805,13 @@
);
}
- this.frm.doc.payments.find(pay => {
- if (pay.default) {
- pay.amount = total_amount_to_pay;
- }
- });
+ if(!this.frm.doc.is_return){
+ this.frm.doc.payments.find(payment => {
+ if (payment.default) {
+ payment.amount = total_amount_to_pay;
+ }
+ });
+ }
this.frm.refresh_fields();
}