fix: pos return payment mode issue (#26875)

This commit is contained in:
Subin Tom 2021-08-10 15:57:30 +05:30 committed by GitHub
parent 1ba04fdfe5
commit 793063bf4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -47,7 +47,10 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
if (in_list(["Sales Invoice", "POS Invoice"], this.frm.doc.doctype) && this.frm.doc.is_pos && if (in_list(["Sales Invoice", "POS Invoice"], this.frm.doc.doctype) && this.frm.doc.is_pos &&
this.frm.doc.is_return) { 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 // Sales person's commission
@ -730,7 +733,7 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
} }
}, },
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; var grand_total = this.frm.doc.rounded_total || this.frm.doc.grand_total;
if(this.frm.doc.party_account_currency == this.frm.doc.currency) { if(this.frm.doc.party_account_currency == this.frm.doc.currency) {
@ -743,17 +746,14 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
precision("base_grand_total") precision("base_grand_total")
); );
} }
this.frm.doc.payments.find(pay => { this.frm.doc.payments.find(pay => {
if (pay.default) { if (pay.default) {
pay.amount = total_amount_to_pay; pay.amount = total_amount_to_pay;
} else { } else {
pay.amount = 0.0 pay.amount = 0.0;
} }
}); });
this.frm.refresh_fields(); this.frm.refresh_fields();
this.calculate_paid_amount();
}, },
set_default_payment: function(total_amount_to_pay, update_paid_amount) { set_default_payment: function(total_amount_to_pay, update_paid_amount) {