Commit 1159cad3 authored by Thomas Baumgart's avatar Thomas Baumgart
Browse files

Show correct currency in report

In multi-currency transactions the transaction commodity was used as
currency instead of the categories currency. The value shown is correct.

This change fixes the problem by overriding the currency in this case
with the one of the category.

BUG: 423870
FIXED-IN: 5.1.1

(cherry picked from commit 49dcabca)
parent df4451f1
......@@ -805,9 +805,13 @@ void QueryTable::constructTransactionTable()
case eMyMoney::Report::RowType::TopCategory:
case eMyMoney::Report::RowType::Tag:
case eMyMoney::Report::RowType::Payee:
if (splitAcc.isAssetLiability())
if (splitAcc.isAssetLiability()) {
qA[ctValue] = ((*it_split).shares() * xr).convert(fraction).toString(); // needed for category reports, in case of multicurrency transaction it breaks it
break;
// make sure we use the right currency of the category
// (will be ignored when converting to base currency)
qA[ctCurrency] = splitAcc.currencyId();
}
break;
default:
break;
}
......@@ -879,8 +883,12 @@ void QueryTable::constructTransactionTable()
case eMyMoney::Report::RowType::TopCategory:
case eMyMoney::Report::RowType::Tag:
case eMyMoney::Report::RowType::Payee:
if (splitAcc.isIncomeExpense())
if (splitAcc.isIncomeExpense()) {
qA[ctValue] = (-(*it_split).shares() * xr).convert(fraction).toString(); // needed for category reports, in case of multicurrency transaction it breaks it
// make sure we use the right currency of the category
// (will be ignored when converting to base currency)
qA[ctCurrency] = splitAcc.currencyId();
}
break;
default:
break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment