diff options
Diffstat (limited to 'src/pool.cc')
-rw-r--r-- | src/pool.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/pool.cc b/src/pool.cc index df20d179..20b585dd 100644 --- a/src/pool.cc +++ b/src/pool.cc @@ -172,12 +172,21 @@ commodity_pool_t::create(commodity_t& comm, const string& mapping_key) { assert(comm); + assert(! comm.has_annotation()); assert(details); assert(! mapping_key.empty()); std::auto_ptr<commodity_t> commodity (new annotated_commodity_t(&comm, details)); + comm.add_flags(COMMODITY_SAW_ANNOTATED); + if (details.price) { + if (details.has_flags(ANNOTATION_PRICE_FIXATED)) + comm.add_flags(COMMODITY_SAW_ANN_PRICE_FIXATED); + else + comm.add_flags(COMMODITY_SAW_ANN_PRICE_FLOAT); + } + commodity->qualified_symbol = comm.symbol(); assert(! commodity->qualified_symbol->empty()); @@ -282,6 +291,9 @@ commodity_pool_t::exchange(const amount_t& amount, moment->date() : optional<date_t>(), tag); annotation.add_flags(ANNOTATION_PRICE_CALCULATED); + if (current_annotation && + current_annotation->has_flags(ANNOTATION_PRICE_FIXATED)) + annotation.add_flags(ANNOTATION_PRICE_FIXATED); if (moment) annotation.add_flags(ANNOTATION_DATE_CALCULATED); if (tag) |