[Fix] Exchange rate revaluation, get entries not working if accounts of the other currency than company currency not available (#16379)
This commit is contained in:
parent
5c86cf54a2
commit
ba54209c86
@ -39,6 +39,8 @@ frappe.ui.form.on('Exchange Rate Revaluation', {
|
||||
});
|
||||
frm.events.get_total_gain_loss(frm);
|
||||
refresh_field("accounts");
|
||||
} else {
|
||||
frappe.msgprint(__("No records found"));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -67,17 +67,19 @@ class ExchangeRateRevaluation(Document):
|
||||
and account_currency != %s
|
||||
order by name""",(self.company, company_currency))
|
||||
|
||||
account_details = frappe.db.sql("""
|
||||
select
|
||||
account, party_type, party, account_currency,
|
||||
sum(debit_in_account_currency) - sum(credit_in_account_currency) as balance_in_account_currency,
|
||||
sum(debit) - sum(credit) as balance
|
||||
from `tabGL Entry`
|
||||
where account in (%s)
|
||||
group by account, party_type, party
|
||||
having sum(debit) != sum(credit)
|
||||
order by account
|
||||
""" % ', '.join(['%s']*len(accounts)), tuple(accounts), as_dict=1)
|
||||
account_details = []
|
||||
if accounts:
|
||||
account_details = frappe.db.sql("""
|
||||
select
|
||||
account, party_type, party, account_currency,
|
||||
sum(debit_in_account_currency) - sum(credit_in_account_currency) as balance_in_account_currency,
|
||||
sum(debit) - sum(credit) as balance
|
||||
from `tabGL Entry`
|
||||
where account in (%s)
|
||||
group by account, party_type, party
|
||||
having sum(debit) != sum(credit)
|
||||
order by account
|
||||
""" % ', '.join(['%s']*len(accounts)), tuple(accounts), as_dict=1)
|
||||
|
||||
return account_details
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user