mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-19 21:19:19 +00:00
Merge pull request #44161 from frappe/mergify/bp/version-14-hotfix/pr-43414
fix: Get Entries not showing accounts with no gain or loss in Exchange Rate Revaluation issue fixed (backport #43414)
This commit is contained in:
@@ -52,6 +52,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 before_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"
|
||||||
|
|
||||||
@@ -226,7 +241,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,
|
||||||
@@ -266,7 +281,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