[Fix] POS auto set paid amount with outstanding amount issue
diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js
index af46dc0..49cbdd0 100644
--- a/erpnext/accounts/page/pos/pos.js
+++ b/erpnext/accounts/page/pos/pos.js
@@ -678,19 +678,13 @@
set_primary_action: function() {
var me = this;
- if (this.frm.doc.docstatus==0 && this.frm.doc.outstanding_amount > 0) {
+ if (this.frm.doc.docstatus==0) {
this.page.set_primary_action(__("Pay"), function() {
me.validate()
me.create_invoice();
me.make_payment();
}, "octicon octicon-credit-card");
- }else if(this.frm.doc.docstatus == 0 && this.frm.doc.items.length){
- this.page.set_primary_action(__("Submit"), function() {
- me.validate()
- me.create_invoice();
- me.write_off_amount()
- })
- }else if(this.frm.doc.docstatus == 1){
+ }else if(this.frm.doc.docstatus == 1) {
this.page.set_primary_action(__("Print"), function() {
html = frappe.render(me.print_template, me.frm.doc)
me.print_document(html)
diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js
index fde33e8..236eb82 100644
--- a/erpnext/public/js/controllers/taxes_and_totals.js
+++ b/erpnext/public/js/controllers/taxes_and_totals.js
@@ -587,6 +587,8 @@
if(data.type == "Cash" && payment_status) {
data.amount = total_amount_to_pay;
payment_status = false;
+ }else{
+ data.amount = 0.0;
}
})
}
diff --git a/erpnext/public/js/payment/payments.js b/erpnext/public/js/payment/payments.js
index 9464f50..90766e9 100644
--- a/erpnext/public/js/payment/payments.js
+++ b/erpnext/public/js/payment/payments.js
@@ -58,11 +58,6 @@
currency: me.frm.doc.currency,
type: data.type
})).appendTo(multimode_payments)
-
- if (data.type == 'Cash' && me.frm.doc.outstanding_amount > 0) {
- me.idx = data.idx;
- me.set_outstanding_amount();
- }
})
}else{
$("<p>No payment mode selected in pos profile</p>").appendTo(multimode_payments)
@@ -157,7 +152,7 @@
data.amount = flt(me.selected_mode.val(), 2)
}
})
- this.calculate_outstanding_amount();
+ this.calculate_outstanding_amount(false);
this.show_amounts();
},