From aac3ea69092119d462e1eee2e1ed49da7332cd7c Mon Sep 17 00:00:00 2001 From: John Ralls Date: Fri, 10 Apr 2020 14:05:48 -0700 Subject: [PATCH] Bug 797676 - Register displays amount in transaction currency... instead of register currency. --- .../ledger-core/split-register-model.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/gnucash/register/ledger-core/split-register-model.c b/gnucash/register/ledger-core/split-register-model.c index 8f3bb21a8c..4abc2133eb 100644 --- a/gnucash/register/ledger-core/split-register-model.c +++ b/gnucash/register/ledger-core/split-register-model.c @@ -1879,10 +1879,6 @@ gnc_split_register_get_debcred_entry (VirtualLocation virt_loc, } else { - /* If this account is not a stock/mutual/currency account, and - * currency != the account commodity, then use the SplitAmount - * instead of the SplitValue. - */ gboolean currency_match; switch (reg->type) { @@ -1893,10 +1889,21 @@ gnc_split_register_get_debcred_entry (VirtualLocation virt_loc, print_info = gnc_commodity_print_info (currency, reg->mismatched_commodities); break; + /* If the register is not a stock/fund register that + * displays both amount and value, display the split value + * in the register's currency instead of the transaction's + * currency. Note that we don't want the split amount as + * some splits will be in a different currency. + */ default: - amount = xaccSplitGetValue (split); + if (commodity && !gnc_commodity_equal (commodity, currency)) + /* Convert this to the "local" value */ + amount = xaccSplitConvertAmount(split, account); + else + amount = xaccSplitGetValue (split); + print_info = gnc_account_print_info (account, reg->mismatched_commodities); - print_info.commodity = currency; + print_info.commodity = commodity; break; } }