[Fix] Wrong difference amount in the payment entry for the internal transfer type

This commit is contained in:
Rohit Waghchaure 2017-11-01 11:45:02 +05:30
parent dd0bdc7fa6
commit 99748dbacf

View File

@ -648,13 +648,13 @@ frappe.ui.form.on('Payment Entry', {
set_difference_amount: function(frm) {
var unallocated_amount = 0;
var total_deductions = frappe.utils.sum($.map(frm.doc.deductions || [],
function(d) { return flt(d.amount) }));
if(frm.doc.party) {
var party_amount = frm.doc.payment_type=="Receive" ?
frm.doc.paid_amount : frm.doc.received_amount;
var total_deductions = frappe.utils.sum($.map(frm.doc.deductions || [],
function(d) { return flt(d.amount) }));
if(frm.doc.total_allocated_amount < party_amount) {
if(frm.doc.payment_type == "Receive") {
unallocated_amount = party_amount - (frm.doc.total_allocated_amount - total_deductions);