fix: index error on Exchange Rate Revaluation creation

(cherry picked from commit bb279e368c)
This commit is contained in:
ruthra kumar
2024-03-17 07:32:13 +05:30
committed by Mergify
parent a0e839e31a
commit 8813b6b2fd

View File

@@ -606,21 +606,21 @@ def get_account_details(
if account_balance and ( if account_balance and (
account_balance[0].balance or account_balance[0].balance_in_account_currency account_balance[0].balance or account_balance[0].balance_in_account_currency
): ):
account_with_new_balance = ExchangeRateRevaluation.calculate_new_account_balance( if account_with_new_balance := ExchangeRateRevaluation.calculate_new_account_balance(
company, posting_date, account_balance company, posting_date, account_balance
) ):
row = account_with_new_balance[0] row = account_with_new_balance[0]
account_details.update( account_details.update(
{ {
"balance_in_base_currency": row["balance_in_base_currency"], "balance_in_base_currency": row["balance_in_base_currency"],
"balance_in_account_currency": row["balance_in_account_currency"], "balance_in_account_currency": row["balance_in_account_currency"],
"current_exchange_rate": row["current_exchange_rate"], "current_exchange_rate": row["current_exchange_rate"],
"new_exchange_rate": row["new_exchange_rate"], "new_exchange_rate": row["new_exchange_rate"],
"new_balance_in_base_currency": row["new_balance_in_base_currency"], "new_balance_in_base_currency": row["new_balance_in_base_currency"],
"new_balance_in_account_currency": row["new_balance_in_account_currency"], "new_balance_in_account_currency": row["new_balance_in_account_currency"],
"zero_balance": row["zero_balance"], "zero_balance": row["zero_balance"],
"gain_loss": row["gain_loss"], "gain_loss": row["gain_loss"],
} }
) )
return account_details return account_details