Commit 181da28c authored by Dawid Wróbel's avatar Dawid Wróbel
Browse files

When importing new transactions, use the target account's commodity (which is...

When importing new transactions, use the target account's commodity (which is set to target account's currency) since it may differ from the base currency.

BUG: 419974
parent d8b7b6b0
......@@ -777,15 +777,14 @@ void MyMoneyStatementReader::processTransactionEntry(const MyMoneyStatement::Tra
&& statementTransactionUnderImport.m_eAction != eMyMoney::Transaction::Action::Shrsout) {
// update the price, while we're here. in the future, this should be
// an option
QString basecurrencyid = file->baseCurrency().id();
const MyMoneyPrice &price = file->price(currencyid, basecurrencyid, statementTransactionUnderImport.m_datePosted, true);
const MyMoneyPrice &price = file->price(currencyid, transactionUnderImport.commodity(), statementTransactionUnderImport.m_datePosted, true);
if (!price.isValid() && ((!statementTransactionUnderImport.m_amount.isZero() && !statementTransactionUnderImport.m_shares.isZero()) || !statementTransactionUnderImport.m_price.isZero())) {
MyMoneyPrice newprice;
if (!statementTransactionUnderImport.m_price.isZero()) {
newprice = MyMoneyPrice(currencyid, basecurrencyid, statementTransactionUnderImport.m_datePosted,
newprice = MyMoneyPrice(currencyid, transactionUnderImport.commodity(), statementTransactionUnderImport.m_datePosted,
statementTransactionUnderImport.m_price.abs(), i18n("Statement Importer"));
} else {
newprice = MyMoneyPrice(currencyid, basecurrencyid, statementTransactionUnderImport.m_datePosted,
newprice = MyMoneyPrice(currencyid, transactionUnderImport.commodity(), statementTransactionUnderImport.m_datePosted,
(statementTransactionUnderImport.m_amount / statementTransactionUnderImport.m_shares).abs(), i18n("Statement Importer"));
}
file->addPrice(newprice);
......
Supports Markdown
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