[Fix] Payment entry not able to submit (#15859)
This commit is contained in:
parent
3f32218bc0
commit
dcb71a61ad
@ -791,15 +791,25 @@ frappe.ui.form.on('Payment Entry', {
|
|||||||
var write_off_row = $.map(frm.doc["deductions"] || [], function(t) {
|
var write_off_row = $.map(frm.doc["deductions"] || [], function(t) {
|
||||||
return t.account==r.message[account] ? t : null; });
|
return t.account==r.message[account] ? t : null; });
|
||||||
|
|
||||||
if (!write_off_row.length) {
|
var row = [];
|
||||||
var row = frm.add_child("deductions");
|
|
||||||
|
var difference_amount = flt(frm.doc.difference_amount,
|
||||||
|
precision("difference_amount"));
|
||||||
|
|
||||||
|
if (!write_off_row.length && difference_amount) {
|
||||||
|
row = frm.add_child("deductions");
|
||||||
row.account = r.message[account];
|
row.account = r.message[account];
|
||||||
row.cost_center = r.message["cost_center"];
|
row.cost_center = r.message["cost_center"];
|
||||||
} else {
|
} else {
|
||||||
var row = write_off_row[0];
|
row = write_off_row[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (row) {
|
||||||
|
row.amount = flt(row.amount) + difference_amount;
|
||||||
|
} else {
|
||||||
|
frappe.msgprint(__("No gain or loss in the exchange rate"))
|
||||||
}
|
}
|
||||||
|
|
||||||
row.amount = flt(row.amount) + flt(frm.doc.difference_amount);
|
|
||||||
refresh_field("deductions");
|
refresh_field("deductions");
|
||||||
|
|
||||||
frm.events.set_unallocated_amount(frm);
|
frm.events.set_unallocated_amount(frm);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user