Fix error message (#14716)

This commit is contained in:
Shreya Shah
2018-06-28 14:14:28 +05:30
committed by Nabin Hait
parent 67d87e29e3
commit 2fbc8509f5

View File

@@ -819,28 +819,30 @@ frappe.ui.form.on('Payment Entry Reference', {
reference_name: function(frm, cdt, cdn) { reference_name: function(frm, cdt, cdn) {
var row = locals[cdt][cdn]; var row = locals[cdt][cdn];
return frappe.call({ if (row.reference_name && row.reference_doctype) {
method: "erpnext.accounts.doctype.payment_entry.payment_entry.get_reference_details", return frappe.call({
args: { method: "erpnext.accounts.doctype.payment_entry.payment_entry.get_reference_details",
reference_doctype: row.reference_doctype, args: {
reference_name: row.reference_name, reference_doctype: row.reference_doctype,
party_account_currency: frm.doc.payment_type=="Receive" ? reference_name: row.reference_name,
frm.doc.paid_from_account_currency : frm.doc.paid_to_account_currency party_account_currency: frm.doc.payment_type=="Receive" ?
}, frm.doc.paid_from_account_currency : frm.doc.paid_to_account_currency
callback: function(r, rt) { },
if(r.message) { callback: function(r, rt) {
$.each(r.message, function(field, value) { if(r.message) {
frappe.model.set_value(cdt, cdn, field, value); $.each(r.message, function(field, value) {
}) frappe.model.set_value(cdt, cdn, field, value);
})
let allocated_amount = frm.doc.unallocated_amount > row.outstanding_amount ? let allocated_amount = frm.doc.unallocated_amount > row.outstanding_amount ?
row.outstanding_amount : frm.doc.unallocated_amount; row.outstanding_amount : frm.doc.unallocated_amount;
frappe.model.set_value(cdt, cdn, 'allocated_amount', allocated_amount); frappe.model.set_value(cdt, cdn, 'allocated_amount', allocated_amount);
frm.refresh_fields(); frm.refresh_fields();
}
} }
} })
}) }
}, },
allocated_amount: function(frm) { allocated_amount: function(frm) {