Set received amount based on paid amount if currency is same
This commit is contained in:
parent
ea5ad84c5e
commit
f43e49f378
@ -414,10 +414,7 @@ frappe.ui.form.on('Payment Entry', {
|
|||||||
|
|
||||||
paid_amount: function(frm) {
|
paid_amount: function(frm) {
|
||||||
frm.set_value("base_paid_amount", flt(frm.doc.paid_amount) * flt(frm.doc.source_exchange_rate));
|
frm.set_value("base_paid_amount", flt(frm.doc.paid_amount) * flt(frm.doc.source_exchange_rate));
|
||||||
|
|
||||||
frm.trigger("reset_received_amount");
|
frm.trigger("reset_received_amount");
|
||||||
|
|
||||||
frm.set_paid_amount_based_on_received_amount = false;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
received_amount: function(frm) {
|
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);
|
frm.events.allocate_party_amount_against_ref_docs(frm, frm.doc.received_amount);
|
||||||
else
|
else
|
||||||
frm.events.set_difference_amount(frm);
|
frm.events.set_difference_amount(frm);
|
||||||
|
|
||||||
|
frm.set_paid_amount_based_on_received_amount = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
reset_received_amount: function(frm) {
|
reset_received_amount: function(frm) {
|
||||||
if(!frm.set_paid_amount_based_on_received_amount &&
|
if(!frm.set_paid_amount_based_on_received_amount &&
|
||||||
(frm.doc.paid_from_account_currency == frm.doc.paid_to_account_currency)) {
|
(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("received_amount", frm.doc.paid_amount);
|
||||||
frm.set_value("target_exchange_rate", frm.doc.source_exchange_rate);
|
frm.set_value("target_exchange_rate", frm.doc.source_exchange_rate);
|
||||||
frm.set_value("base_received_amount", frm.doc.base_paid_amount);
|
frm.set_value("base_received_amount", frm.doc.base_paid_amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(frm.doc.payment_type == "Receive")
|
if(frm.doc.payment_type == "Receive")
|
||||||
frm.events.allocate_party_amount_against_ref_docs(frm, frm.doc.paid_amount);
|
frm.events.allocate_party_amount_against_ref_docs(frm, frm.doc.paid_amount);
|
||||||
else
|
else
|
||||||
@ -611,7 +605,6 @@ frappe.ui.form.on('Payment Entry', {
|
|||||||
if(frm.doc.total_allocated_amount < party_amount)
|
if(frm.doc.total_allocated_amount < party_amount)
|
||||||
unallocated_amount = party_amount - frm.doc.total_allocated_amount;
|
unallocated_amount = party_amount - frm.doc.total_allocated_amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
frm.set_value("unallocated_amount", unallocated_amount);
|
frm.set_value("unallocated_amount", unallocated_amount);
|
||||||
|
|
||||||
var difference_amount = 0;
|
var difference_amount = 0;
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
"document_type": "",
|
"document_type": "",
|
||||||
|
"editable_grid": 0,
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
@ -1135,7 +1136,7 @@
|
|||||||
"no_copy": 0,
|
"no_copy": 0,
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"precision": "2",
|
"precision": "2",
|
||||||
"print_hide": 0,
|
"print_hide": 1,
|
||||||
"print_hide_if_no_value": 0,
|
"print_hide_if_no_value": 0,
|
||||||
"read_only": 1,
|
"read_only": 1,
|
||||||
"report_hide": 0,
|
"report_hide": 0,
|
||||||
@ -3676,7 +3677,7 @@
|
|||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"menu_index": 0,
|
"menu_index": 0,
|
||||||
"modified": "2016-07-07 13:40:27.977803",
|
"modified": "2016-08-03 11:50:49.680278",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Sales Invoice",
|
"name": "Sales Invoice",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user