Prevent assigning capital gains splits to lots.

They're generated by lots, and when xaccSplitComputeCapGains sees one it grabs the originating lot which naturally doesn't balance.
This commit is contained in:
John Ralls 2014-08-01 16:15:52 -07:00
parent 1134d64a35
commit bad092a46d

View File

@ -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;
}
@ -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;