Merge pull request #5986 from nabinhait/pe_fix_101

Set received amount based on paid amount if currency is same
This commit is contained in:
Nabin Hait 2016-08-03 17:54:01 +05:30 committed by GitHub
commit 155074479b
2 changed files with 6 additions and 12 deletions

View File

@ -414,10 +414,7 @@ frappe.ui.form.on('Payment Entry', {
paid_amount: function(frm) {
frm.set_value("base_paid_amount", flt(frm.doc.paid_amount) * flt(frm.doc.source_exchange_rate));
frm.trigger("reset_received_amount");
frm.set_paid_amount_based_on_received_amount = false;
},
received_amount: function(frm) {
@ -436,22 +433,19 @@ frappe.ui.form.on('Payment Entry', {
frm.events.allocate_party_amount_against_ref_docs(frm, frm.doc.received_amount);
else
frm.events.set_difference_amount(frm);
frm.set_paid_amount_based_on_received_amount = false;
},
reset_received_amount: function(frm) {
if(!frm.set_paid_amount_based_on_received_amount &&
(frm.doc.paid_from_account_currency == frm.doc.paid_to_account_currency)) {
// var total_deductions = frappe.utils.sum($.map(frm.doc.deductions || [],
// function(d) { return d.amount}));
//
// var received_amount = frm.doc.paid_amount +
// flt(total_deductions) / flt(frm.doc.source_exchange_rate);
//
frm.set_value("received_amount", frm.doc.paid_amount);
frm.set_value("target_exchange_rate", frm.doc.source_exchange_rate);
frm.set_value("base_received_amount", frm.doc.base_paid_amount);
}
if(frm.doc.payment_type == "Receive")
frm.events.allocate_party_amount_against_ref_docs(frm, frm.doc.paid_amount);
else
@ -611,7 +605,6 @@ frappe.ui.form.on('Payment Entry', {
if(frm.doc.total_allocated_amount < party_amount)
unallocated_amount = party_amount - frm.doc.total_allocated_amount;
}
frm.set_value("unallocated_amount", unallocated_amount);
var difference_amount = 0;

View File

@ -10,6 +10,7 @@
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
"editable_grid": 0,
"fields": [
{
"allow_on_submit": 0,
@ -1135,7 +1136,7 @@
"no_copy": 0,
"permlevel": 0,
"precision": "2",
"print_hide": 0,
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
@ -3676,7 +3677,7 @@
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
"modified": "2016-07-07 13:40:27.977803",
"modified": "2016-08-03 11:50:49.680278",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice",