mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-02 11:49:10 +00:00
refactor: set received amount based on paid amount
(cherry picked from commit 5ff540bd82)
This commit is contained in:
@@ -812,6 +812,15 @@ 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));
|
||||||
|
let company_currency = frappe.get_doc(":Company", frm.doc.company).default_currency;
|
||||||
|
if (!frm.doc.received_amount) {
|
||||||
|
if (frm.doc.paid_from_account_currency == frm.doc.paid_to_account_currency) {
|
||||||
|
frm.set_value("received_amount", frm.doc.paid_amount);
|
||||||
|
} else if (company_currency == frm.doc.paid_to_account_currency) {
|
||||||
|
frm.set_value("received_amount", frm.doc.base_paid_amount);
|
||||||
|
frm.set_value("base_received_amount", frm.doc.base_paid_amount);
|
||||||
|
}
|
||||||
|
}
|
||||||
frm.trigger("reset_received_amount");
|
frm.trigger("reset_received_amount");
|
||||||
frm.events.hide_unhide_fields(frm);
|
frm.events.hide_unhide_fields(frm);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user