mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-18 14:32:13 +00:00
fix(ux): set amount based on account currency while adding new row
(cherry picked from commit 0ff04f774d)
This commit is contained in:
@@ -360,21 +360,23 @@ erpnext.accounts.JournalEntry = class JournalEntry extends frappe.ui.form.Contro
|
|||||||
|
|
||||||
accounts_add(doc, cdt, cdn) {
|
accounts_add(doc, cdt, cdn) {
|
||||||
var row = frappe.get_doc(cdt, cdn);
|
var row = frappe.get_doc(cdt, cdn);
|
||||||
|
row.exchange_rate = 1;
|
||||||
$.each(doc.accounts, function (i, d) {
|
$.each(doc.accounts, function (i, d) {
|
||||||
if (d.account && d.party && d.party_type) {
|
if (d.account && d.party && d.party_type) {
|
||||||
row.account = d.account;
|
row.account = d.account;
|
||||||
row.party = d.party;
|
row.party = d.party;
|
||||||
row.party_type = d.party_type;
|
row.party_type = d.party_type;
|
||||||
|
row.exchange_rate = d.exchange_rate;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// set difference
|
// set difference
|
||||||
if (doc.difference) {
|
if (doc.difference) {
|
||||||
if (doc.difference > 0) {
|
if (doc.difference > 0) {
|
||||||
row.credit_in_account_currency = doc.difference;
|
row.credit_in_account_currency = doc.difference / row.exchange_rate;
|
||||||
row.credit = doc.difference;
|
row.credit = doc.difference;
|
||||||
} else {
|
} else {
|
||||||
row.debit_in_account_currency = -doc.difference;
|
row.debit_in_account_currency = -doc.difference / row.exchange_rate;
|
||||||
row.debit = -doc.difference;
|
row.debit = -doc.difference;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user