refactor: exclude balances while setting currency
This commit is contained in:
@@ -385,13 +385,12 @@ frappe.ui.form.on("Journal Entry Account", {
|
|||||||
if(!d.account && d.party_type && d.party) {
|
if(!d.account && d.party_type && d.party) {
|
||||||
if(!frm.doc.company) frappe.throw(__("Please select Company"));
|
if(!frm.doc.company) frappe.throw(__("Please select Company"));
|
||||||
return frm.call({
|
return frm.call({
|
||||||
method: "erpnext.accounts.doctype.journal_entry.journal_entry.get_party_account_and_balance",
|
method: "erpnext.accounts.doctype.journal_entry.journal_entry.get_party_account_and_currency",
|
||||||
child: d,
|
child: d,
|
||||||
args: {
|
args: {
|
||||||
company: frm.doc.company,
|
company: frm.doc.company,
|
||||||
party_type: d.party_type,
|
party_type: d.party_type,
|
||||||
party: d.party,
|
party: d.party,
|
||||||
cost_center: d.cost_center
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1405,22 +1405,15 @@ def get_outstanding(args):
|
|||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_party_account_and_balance(company, party_type, party, cost_center=None):
|
def get_party_account_and_currency(company, party_type, party):
|
||||||
if not frappe.has_permission("Account"):
|
if not frappe.has_permission("Account"):
|
||||||
frappe.msgprint(_("No Permission"), raise_exception=1)
|
frappe.msgprint(_("No Permission"), raise_exception=1)
|
||||||
|
|
||||||
account = get_party_account(party_type, party, company)
|
account = get_party_account(party_type, party, company)
|
||||||
|
|
||||||
account_balance = get_balance_on(account=account, cost_center=cost_center)
|
|
||||||
party_balance = get_balance_on(
|
|
||||||
party_type=party_type, party=party, company=company, cost_center=cost_center
|
|
||||||
)
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"account": account,
|
"account": account,
|
||||||
"balance": account_balance,
|
"account_currency": frappe.get_cached_value("Account", account, "account_currency"),
|
||||||
"party_balance": party_balance,
|
|
||||||
"account_currency": frappe.db.get_value("Account", account, "account_currency"),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user