summaryrefslogtreecommitdiff
path: root/src/draft.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-12-07 21:23:50 -0500
committerJohn Wiegley <johnw@newartisans.com>2009-12-07 21:23:50 -0500
commitf1a2a5a18d5e7104ad308b2f56a9188f441bb7f2 (patch)
treeeeef84ba9b48e11296793c64a1ce20436cfd4316 /src/draft.cc
parent6d0ab845eaec51946190c847f1ad08f910e5a003 (diff)
downloadfork-ledger-f1a2a5a18d5e7104ad308b2f56a9188f441bb7f2.tar.gz
fork-ledger-f1a2a5a18d5e7104ad308b2f56a9188f441bb7f2.tar.bz2
fork-ledger-f1a2a5a18d5e7104ad308b2f56a9188f441bb7f2.zip
Cost of a post with neg. amount should be negative
Diffstat (limited to 'src/draft.cc')
-rw-r--r--src/draft.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/draft.cc b/src/draft.cc
index 8478a31d..fc53e956 100644
--- a/src/draft.cc
+++ b/src/draft.cc
@@ -458,6 +458,9 @@ xact_t * draft_t::insert(journal_t& journal)
*post.cost *= new_post->amount;
post.cost->set_commodity(cost_commodity);
}
+ else if (new_post->amount.sign() < 0) {
+ new_post->cost->in_place_negate();
+ }
new_post->cost = *post.cost;
DEBUG("derive.xact", "Copied over posting cost");