diff options
author | John Wiegley <johnw@newartisans.com> | 2009-01-30 19:27:42 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-01-30 19:27:42 -0400 |
commit | 3dbdeb2917eba0145b6f4c967ebda230cd8ace59 (patch) | |
tree | e8336fd29f39f91692ab5c769e9853a90a81d19c | |
parent | 165300ea84fd420d67e0e1b7cfe3b77377d5f885 (diff) | |
download | fork-ledger-3dbdeb2917eba0145b6f4c967ebda230cd8ace59.tar.gz fork-ledger-3dbdeb2917eba0145b6f4c967ebda230cd8ace59.tar.bz2 fork-ledger-3dbdeb2917eba0145b6f4c967ebda230cd8ace59.zip |
Don't allow the "keep precision" flag to propagate into the balance amount.
-rw-r--r-- | src/entry.cc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/entry.cc b/src/entry.cc index 9b9afe55..8a4f851f 100644 --- a/src/entry.cc +++ b/src/entry.cc @@ -105,7 +105,18 @@ bool entry_base_t::finalize() amount_t& p(xact->cost ? *xact->cost : xact->amount); DEBUG("entry.finalize", "xact must balance = " << p); if (! p.is_null()) { - add_or_set_value(balance, p); + if (p.keep_precision()) { + amount_t temp(p); + // If the amount was a cost, it very likely has the "keep_precision" + // flag set, meaning commodity display precision is ignored when + // displaying the amount. We never want this set for the balance, + // so we must clear the flag in a temporary to avoid it propagating + // into the balance. + temp.set_keep_precision(false); + add_or_set_value(balance, temp); + } else { + add_or_set_value(balance, p); + } } else { if (null_xact) throw_(std::logic_error, |