summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-24 15:18:57 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-24 15:18:57 -0400
commit5ad9bc3951fcbecb5fcf7c1127e8f91e547fd37b (patch)
tree6515374a2a50d412b902c56fe65281aad22e2614 /src
parentf13709f71afec388f5dcc00f6fb468917390927d (diff)
downloadfork-ledger-5ad9bc3951fcbecb5fcf7c1127e8f91e547fd37b.tar.gz
fork-ledger-5ad9bc3951fcbecb5fcf7c1127e8f91e547fd37b.tar.bz2
fork-ledger-5ad9bc3951fcbecb5fcf7c1127e8f91e547fd37b.zip
Propagate commodity flags in costs sometimes
If a commodity has never been seen before, and it is used in a cost amount, remember the display flags.
Diffstat (limited to 'src')
-rw-r--r--src/amount.cc8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/amount.cc b/src/amount.cc
index 813cbac0..6f3306cc 100644
--- a/src/amount.cc
+++ b/src/amount.cc
@@ -932,17 +932,15 @@ bool amount_t::parse(std::istream& in, const parse_flags_t& flags)
// Set the commodity's flags and precision accordingly
- if (commodity_ && ! flags.has_flags(PARSE_NO_MIGRATE)) {
+ if (commodity_ && (newly_created || ! flags.has_flags(PARSE_NO_MIGRATE))) {
commodity().add_flags(comm_flags);
if (quantity->prec > commodity().precision())
commodity().set_precision(quantity->prec);
}
-
- // Setup the amount's own flags
-
- if (flags.has_flags(PARSE_NO_MIGRATE))
+ else if (flags.has_flags(PARSE_NO_MIGRATE)) {
set_keep_precision(true);
+ }
// Now we have the final number. Remove commas and periods, if
// necessary.