mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Bug 798600 - CSV import of multi-split security transactions fails to 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.
This commit is contained in:
parent
3f3460fec9
commit
9e1268d934
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user