Skip to content

Commit

Permalink
Bug 798600 - CSV import of multi-split security transactions fails to…
Browse files Browse the repository at this point in the history
… load capital gain - part 1

Transactions with capital gains processing can have
splits in transaction currency with a zero amount
and a non-zero value. To properly import those,
prefer the value column even if transaction
currency equals account commodity.
Previous (wrong) assumption was that in case
of a same-currency split, the amount would
always be the value.
  • Loading branch information
gjanssens committed Feb 14, 2023
1 parent 3f3460f commit 9e1268d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gnucash/import-export/csv-imp/gnc-imp-props-tx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -758,15 +758,15 @@ void GncPreSplit::create_split (std::shared_ptr<DraftTransaction> draft_trans)
auto value = GncNumeric();
auto trans_curr = xaccTransGetCurrency(draft_trans->trans);
auto acct_comm = xaccAccountGetCommodity(account);
if (gnc_commodity_equiv(trans_curr, acct_comm))
value = amount;
else if (m_value || m_value_neg)
if (m_value || m_value_neg)
{
if (m_value)
value += *m_value;
if (m_value_neg)
value -= *m_value_neg;
}
else if (gnc_commodity_equiv(trans_curr, acct_comm))
value = amount;
else if (tamount)
value = -*tamount;
else if (m_price)
Expand Down

0 comments on commit 9e1268d

Please sign in to comment.