From 61b4a43d84090e216198ccbee0d3de44aff15050 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Wed, 20 Jul 2016 11:21:51 +0530 Subject: [PATCH] [Fix] POS auto set paid amount with outstanding amount issue --- erpnext/accounts/page/pos/pos.js | 10 ++-------- erpnext/public/js/controllers/taxes_and_totals.js | 2 ++ erpnext/public/js/payment/payments.js | 7 +------ 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js index af46dc070f..49cbdd0a68 100644 --- a/erpnext/accounts/page/pos/pos.js +++ b/erpnext/accounts/page/pos/pos.js @@ -678,19 +678,13 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ 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 fde33e8415..236eb82473 100644 --- a/erpnext/public/js/controllers/taxes_and_totals.js +++ b/erpnext/public/js/controllers/taxes_and_totals.js @@ -587,6 +587,8 @@ erpnext.taxes_and_totals = erpnext.payments.extend({ 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 9464f50f67..90766e9eb6 100644 --- a/erpnext/public/js/payment/payments.js +++ b/erpnext/public/js/payment/payments.js @@ -58,11 +58,6 @@ erpnext.payments = erpnext.stock.StockController.extend({ 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{ $("

No payment mode selected in pos profile

").appendTo(multimode_payments) @@ -157,7 +152,7 @@ erpnext.payments = erpnext.stock.StockController.extend({ data.amount = flt(me.selected_mode.val(), 2) } }) - this.calculate_outstanding_amount(); + this.calculate_outstanding_amount(false); this.show_amounts(); },