fix: pos return payment mode issue (#26875)
diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js
index 53d5278..9d8fcb6 100644
--- a/erpnext/public/js/controllers/taxes_and_totals.js
+++ b/erpnext/public/js/controllers/taxes_and_totals.js
@@ -47,7 +47,10 @@
if (in_list(["Sales Invoice", "POS Invoice"], this.frm.doc.doctype) && this.frm.doc.is_pos &&
this.frm.doc.is_return) {
- this.update_paid_amount_for_return();
+ if (this.frm.doc.doctype == "Sales Invoice") {
+ this.set_total_amount_to_default_mop();
+ }
+ this.calculate_paid_amount();
}
// Sales person's commission
@@ -730,7 +733,7 @@
}
},
- update_paid_amount_for_return: function() {
+ set_total_amount_to_default_mop: function() {
var grand_total = this.frm.doc.rounded_total || this.frm.doc.grand_total;
if(this.frm.doc.party_account_currency == this.frm.doc.currency) {
@@ -743,17 +746,14 @@
precision("base_grand_total")
);
}
-
this.frm.doc.payments.find(pay => {
if (pay.default) {
pay.amount = total_amount_to_pay;
} else {
- pay.amount = 0.0
+ pay.amount = 0.0;
}
});
this.frm.refresh_fields();
-
- this.calculate_paid_amount();
},
set_default_payment: function(total_amount_to_pay, update_paid_amount) {