Set paid amount to zero if not pos
This commit is contained in:
parent
a8dbb0dd41
commit
54106807e4
@ -403,16 +403,15 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
|||||||
// paid_amount and write_off_amount is only for POS Invoice
|
// paid_amount and write_off_amount is only for POS Invoice
|
||||||
// total_advance is only for non POS Invoice
|
// total_advance is only for non POS Invoice
|
||||||
if(this.frm.doc.doctype == "Sales Invoice" && this.frm.doc.docstatus==0) {
|
if(this.frm.doc.doctype == "Sales Invoice" && this.frm.doc.docstatus==0) {
|
||||||
if(this.frm.doc.paid_amount==null) {
|
|
||||||
frappe.model.round_floats_in(this.frm.doc, ["grand_total", "total_advance", "write_off_amount",
|
frappe.model.round_floats_in(this.frm.doc, ["grand_total", "total_advance", "write_off_amount",
|
||||||
"paid_amount"]);
|
"paid_amount"]);
|
||||||
var total_amount_to_pay = this.frm.doc.grand_total - this.frm.doc.write_off_amount
|
var total_amount_to_pay = this.frm.doc.grand_total - this.frm.doc.write_off_amount
|
||||||
- this.frm.doc.total_advance;
|
- this.frm.doc.total_advance;
|
||||||
this.frm.doc.paid_amount = this.frm.doc.is_pos ? flt (total_amount_to_pay) : 0.0;
|
this.frm.doc.paid_amount = (this.frm.doc.is_pos && !this.frm.doc.paid_amount) ?
|
||||||
|
flt(total_amount_to_pay): 0.0;
|
||||||
this.frm.set_value("outstanding_amount", flt(total_amount_to_pay
|
this.frm.set_value("outstanding_amount", flt(total_amount_to_pay
|
||||||
- this.frm.doc.paid_amount, precision("outstanding_amount")));
|
- this.frm.doc.paid_amount, precision("outstanding_amount")));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
calculate_commission: function() {
|
calculate_commission: function() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user