[Fix] POS auto set paid amount with outstanding amount issue

This commit is contained in:
Rohit Waghchaure 2016-07-20 11:21:51 +05:30
parent 649e2538e5
commit 61b4a43d84
3 changed files with 5 additions and 14 deletions

View File

@ -678,18 +678,12 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
set_primary_action: function() { set_primary_action: function() {
var me = this; 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() { this.page.set_primary_action(__("Pay"), function() {
me.validate() me.validate()
me.create_invoice(); me.create_invoice();
me.make_payment(); me.make_payment();
}, "octicon octicon-credit-card"); }, "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() { this.page.set_primary_action(__("Print"), function() {
html = frappe.render(me.print_template, me.frm.doc) html = frappe.render(me.print_template, me.frm.doc)

View File

@ -587,6 +587,8 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
if(data.type == "Cash" && payment_status) { if(data.type == "Cash" && payment_status) {
data.amount = total_amount_to_pay; data.amount = total_amount_to_pay;
payment_status = false; payment_status = false;
}else{
data.amount = 0.0;
} }
}) })
} }

View File

@ -58,11 +58,6 @@ erpnext.payments = erpnext.stock.StockController.extend({
currency: me.frm.doc.currency, currency: me.frm.doc.currency,
type: data.type type: data.type
})).appendTo(multimode_payments) })).appendTo(multimode_payments)
if (data.type == 'Cash' && me.frm.doc.outstanding_amount > 0) {
me.idx = data.idx;
me.set_outstanding_amount();
}
}) })
}else{ }else{
$("<p>No payment mode selected in pos profile</p>").appendTo(multimode_payments) $("<p>No payment mode selected in pos profile</p>").appendTo(multimode_payments)
@ -157,7 +152,7 @@ erpnext.payments = erpnext.stock.StockController.extend({
data.amount = flt(me.selected_mode.val(), 2) data.amount = flt(me.selected_mode.val(), 2)
} }
}) })
this.calculate_outstanding_amount(); this.calculate_outstanding_amount(false);
this.show_amounts(); this.show_amounts();
}, },