mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-25 16:04:46 +00:00
Set target exchange rate from source if currency is same
This commit is contained in:
@@ -376,14 +376,32 @@ frappe.ui.form.on('Payment Entry', {
|
|||||||
source_exchange_rate: function(frm) {
|
source_exchange_rate: function(frm) {
|
||||||
if (frm.doc.paid_amount) {
|
if (frm.doc.paid_amount) {
|
||||||
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));
|
||||||
|
if(!frm.set_paid_amount_based_on_received_amount &&
|
||||||
|
(frm.doc.paid_from_account_currency == frm.doc.paid_to_account_currency)) {
|
||||||
|
frm.set_value("target_exchange_rate", frm.doc.source_exchange_rate);
|
||||||
|
frm.set_value("base_received_amount", frm.doc.base_paid_amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
frm.events.set_difference_amount(frm);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
target_exchange_rate: function(frm) {
|
target_exchange_rate: function(frm) {
|
||||||
|
frm.set_paid_amount_based_on_received_amount = true;
|
||||||
|
|
||||||
if (frm.doc.received_amount) {
|
if (frm.doc.received_amount) {
|
||||||
frm.set_value("base_received_amount",
|
frm.set_value("base_received_amount",
|
||||||
flt(frm.doc.received_amount) * flt(frm.doc.target_exchange_rate));
|
flt(frm.doc.received_amount) * flt(frm.doc.target_exchange_rate));
|
||||||
|
|
||||||
|
if(!frm.doc.source_exchange_rate &&
|
||||||
|
(frm.doc.paid_from_account_currency == frm.doc.paid_to_account_currency)) {
|
||||||
|
frm.set_value("source_exchange_rate", frm.doc.target_exchange_rate);
|
||||||
|
frm.set_value("base_paid_amount", frm.doc.base_received_amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
frm.events.set_difference_amount(frm);
|
||||||
}
|
}
|
||||||
|
frm.set_paid_amount_based_on_received_amount = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
paid_amount: function(frm) {
|
paid_amount: function(frm) {
|
||||||
|
|||||||
Reference in New Issue
Block a user