Skip to content

Commit

Permalink
Prevent assigning capital gains splits to lots.
Browse files Browse the repository at this point in the history
They're generated by lots, and when xaccSplitComputeCapGains sees one it grabs the originating lot which naturally doesn't balance.
  • Loading branch information
jralls committed Aug 22, 2014
1 parent 1134d64 commit bad092a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/engine/cap-gains.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ xaccAccountHasTrades (const Account *acc)
{
Split *s = node->data;
Transaction *t = s->parent;
if (s->gains == GAINS_STATUS_GAINS) continue;
if (acc_comm != t->common_currency) return TRUE;
}

Expand Down Expand Up @@ -444,6 +445,8 @@ xaccSplitAssign (Split *split)
* have lots, we are done.
*/
if (split->lot) return FALSE;
g_assert (split->gains == GAINS_STATUS_UNKNOWN ||
(split->gains & GAINS_STATUS_GAINS) == FALSE);
acc = split->acc;
if (!xaccAccountHasTrades (acc))
return FALSE;
Expand Down

0 comments on commit bad092a

Please sign in to comment.