summaryrefslogtreecommitdiff
path: root/src/xact.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2010-06-10 14:45:44 -0400
committerJohn Wiegley <johnw@newartisans.com>2010-06-10 14:45:44 -0400
commit3e05dce72e35f093560ec0b5b2dc65b1bdf94267 (patch)
tree0f90058116bda91a06b18afe51f0374a5eef4f47 /src/xact.cc
parentbea90a2b985694acb8554f50136fa5afc7fdba12 (diff)
downloadfork-ledger-3e05dce72e35f093560ec0b5b2dc65b1bdf94267.tar.gz
fork-ledger-3e05dce72e35f093560ec0b5b2dc65b1bdf94267.tar.bz2
fork-ledger-3e05dce72e35f093560ec0b5b2dc65b1bdf94267.zip
gain/loss posting based on a virtual should also be
Diffstat (limited to 'src/xact.cc')
-rw-r--r--src/xact.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/xact.cc b/src/xact.cc
index 60186b1e..eebe4be9 100644
--- a/src/xact.cc
+++ b/src/xact.cc
@@ -281,7 +281,8 @@ bool xact_base_t::finalize()
gain_loss.in_place_round();
DEBUG("xact.finalize", "gain_loss rounds to = " << gain_loss);
- add_or_set_value(balance, gain_loss.reduced());
+ if (post->must_balance())
+ add_or_set_value(balance, gain_loss.reduced());
account_t * account;
if (gain_loss.sign() > 0)
@@ -291,6 +292,10 @@ bool xact_base_t::finalize()
post_t * p = new post_t(account, gain_loss, ITEM_GENERATED);
p->set_state(post->state());
+ if (post->has_flags(POST_VIRTUAL)) {
+ DEBUG("xact.finalize", "gain_loss came from a virtual post");
+ p->add_flags(post->flags() & (POST_VIRTUAL | POST_MUST_BALANCE));
+ }
add_post(p);
DEBUG("xact.finalize", "added gain_loss, balance = " << balance);
} else {