[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);
|
frm.events.get_total_gain_loss(frm);
|
||||||
refresh_field("accounts");
|
refresh_field("accounts");
|
||||||
|
} else {
|
||||||
|
frappe.msgprint(__("No records found"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -67,17 +67,19 @@ class ExchangeRateRevaluation(Document):
|
|||||||
and account_currency != %s
|
and account_currency != %s
|
||||||
order by name""",(self.company, company_currency))
|
order by name""",(self.company, company_currency))
|
||||||
|
|
||||||
account_details = frappe.db.sql("""
|
account_details = []
|
||||||
select
|
if accounts:
|
||||||
account, party_type, party, account_currency,
|
account_details = frappe.db.sql("""
|
||||||
sum(debit_in_account_currency) - sum(credit_in_account_currency) as balance_in_account_currency,
|
select
|
||||||
sum(debit) - sum(credit) as balance
|
account, party_type, party, account_currency,
|
||||||
from `tabGL Entry`
|
sum(debit_in_account_currency) - sum(credit_in_account_currency) as balance_in_account_currency,
|
||||||
where account in (%s)
|
sum(debit) - sum(credit) as balance
|
||||||
group by account, party_type, party
|
from `tabGL Entry`
|
||||||
having sum(debit) != sum(credit)
|
where account in (%s)
|
||||||
order by account
|
group by account, party_type, party
|
||||||
""" % ', '.join(['%s']*len(accounts)), tuple(accounts), as_dict=1)
|
having sum(debit) != sum(credit)
|
||||||
|
order by account
|
||||||
|
""" % ', '.join(['%s']*len(accounts)), tuple(accounts), as_dict=1)
|
||||||
|
|
||||||
return account_details
|
return account_details
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user