Merge pull request #48162 from aerele/gl_entry_exchange_gain_or_loss
fix: add validation for exchange gain/loss entries
This commit is contained in:
@@ -200,8 +200,7 @@ def get_gl_entries(filters, accounting_dimensions):
|
|||||||
voucher_type, voucher_subtype, voucher_no, {dimension_fields}
|
voucher_type, voucher_subtype, voucher_no, {dimension_fields}
|
||||||
cost_center, project, {transaction_currency_fields}
|
cost_center, project, {transaction_currency_fields}
|
||||||
against_voucher_type, against_voucher, account_currency,
|
against_voucher_type, against_voucher, account_currency,
|
||||||
against, is_opening, creation {select_fields},
|
against, is_opening, creation {select_fields}
|
||||||
transaction_currency
|
|
||||||
from `tabGL Entry`
|
from `tabGL Entry`
|
||||||
where company=%(company)s {get_conditions(filters)}
|
where company=%(company)s {get_conditions(filters)}
|
||||||
{order_by_statement}
|
{order_by_statement}
|
||||||
|
|||||||
@@ -101,7 +101,6 @@ def convert_to_presentation_currency(gl_entries, currency_info):
|
|||||||
account_currencies = list(set(entry["account_currency"] for entry in gl_entries))
|
account_currencies = list(set(entry["account_currency"] for entry in gl_entries))
|
||||||
|
|
||||||
for entry in gl_entries:
|
for entry in gl_entries:
|
||||||
transaction_currency = entry.get("transaction_currency")
|
|
||||||
debit = flt(entry["debit"])
|
debit = flt(entry["debit"])
|
||||||
credit = flt(entry["credit"])
|
credit = flt(entry["credit"])
|
||||||
debit_in_account_currency = flt(entry["debit_in_account_currency"])
|
debit_in_account_currency = flt(entry["debit_in_account_currency"])
|
||||||
@@ -111,7 +110,7 @@ def convert_to_presentation_currency(gl_entries, currency_info):
|
|||||||
if (
|
if (
|
||||||
len(account_currencies) == 1
|
len(account_currencies) == 1
|
||||||
and account_currency == presentation_currency
|
and account_currency == presentation_currency
|
||||||
and (transaction_currency is None or account_currency == transaction_currency)
|
and (debit_in_account_currency or credit_in_account_currency)
|
||||||
):
|
):
|
||||||
entry["debit"] = debit_in_account_currency
|
entry["debit"] = debit_in_account_currency
|
||||||
entry["credit"] = credit_in_account_currency
|
entry["credit"] = credit_in_account_currency
|
||||||
|
|||||||
Reference in New Issue
Block a user