mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-20 18:54:55 +00:00
fix: Get Entries not showing accounts with no gain or loss in Exchange Rate Revaluation issue
(cherry picked from commit 6de6f55b39)
This commit is contained in:
@@ -74,6 +74,21 @@ class ExchangeRateRevaluation(Document):
|
|||||||
if not (self.company and self.posting_date):
|
if not (self.company and self.posting_date):
|
||||||
frappe.throw(_("Please select Company and Posting Date to getting entries"))
|
frappe.throw(_("Please select Company and Posting Date to getting entries"))
|
||||||
|
|
||||||
|
def on_submit(self):
|
||||||
|
self.remove_accounts_without_gain_loss()
|
||||||
|
|
||||||
|
def remove_accounts_without_gain_loss(self):
|
||||||
|
self.accounts = [account for account in self.accounts if account.gain_loss]
|
||||||
|
|
||||||
|
if not self.accounts:
|
||||||
|
frappe.throw(_("At least one account with exchange gain or loss is required"))
|
||||||
|
|
||||||
|
frappe.msgprint(
|
||||||
|
_("Removing rows without exchange gain or loss"),
|
||||||
|
alert=True,
|
||||||
|
indicator="yellow",
|
||||||
|
)
|
||||||
|
|
||||||
def on_cancel(self):
|
def on_cancel(self):
|
||||||
self.ignore_linked_doctypes = "GL Entry"
|
self.ignore_linked_doctypes = "GL Entry"
|
||||||
|
|
||||||
@@ -248,7 +263,7 @@ class ExchangeRateRevaluation(Document):
|
|||||||
new_exchange_rate = get_exchange_rate(d.account_currency, company_currency, posting_date)
|
new_exchange_rate = get_exchange_rate(d.account_currency, company_currency, posting_date)
|
||||||
new_balance_in_base_currency = flt(d.balance_in_account_currency * new_exchange_rate)
|
new_balance_in_base_currency = flt(d.balance_in_account_currency * new_exchange_rate)
|
||||||
gain_loss = flt(new_balance_in_base_currency, precision) - flt(d.balance, precision)
|
gain_loss = flt(new_balance_in_base_currency, precision) - flt(d.balance, precision)
|
||||||
if gain_loss:
|
|
||||||
accounts.append(
|
accounts.append(
|
||||||
{
|
{
|
||||||
"account": d.account,
|
"account": d.account,
|
||||||
@@ -288,7 +303,6 @@ class ExchangeRateRevaluation(Document):
|
|||||||
current_exchange_rate * d.balance_in_account_currency
|
current_exchange_rate * d.balance_in_account_currency
|
||||||
)
|
)
|
||||||
|
|
||||||
if gain_loss:
|
|
||||||
accounts.append(
|
accounts.append(
|
||||||
{
|
{
|
||||||
"account": d.account,
|
"account": d.account,
|
||||||
|
|||||||
Reference in New Issue
Block a user