Never output calculate commodity valuation expressions

This commit is contained in:
John Wiegley 2012-03-20 05:03:18 -05:00
parent e3248ee5a6
commit 3fb7490bc9
2 changed files with 3 additions and 6 deletions

View file

@ -212,8 +212,7 @@ void annotation_t::print(std::ostream& out, bool keep_base,
(! no_computed_annotations || ! has_flags(ANNOTATION_TAG_CALCULATED)))
out << " (" << *tag << ')';
if (value_expr && (! no_computed_annotations ||
! has_flags(ANNOTATION_VALUE_EXPR_CALCULATED)))
if (value_expr && ! has_flags(ANNOTATION_VALUE_EXPR_CALCULATED))
out << " ((" << *value_expr << "))";
}
@ -327,10 +326,7 @@ annotated_commodity_t::strip_annotations(const keep_details_t& what_to_keep)
if ((keep_price && details.price) ||
(keep_date && details.date) ||
(keep_tag && details.tag) ||
(details.value_expr &&
! details.has_flags(ANNOTATION_VALUE_EXPR_CALCULATED)))
{
(keep_tag && details.tag)) {
new_comm = pool().find_or_create
(referent(), annotation_t(keep_price ? details.price : none,
keep_date ? details.date : none,

View file

@ -688,6 +688,7 @@ void extend_post(post_t& post, journal_t& journal)
if (! details) {
annotation_t new_details;
new_details.value_expr = value_expr;
commodity_t * new_comm =
commodity_pool_t::current_pool->find_or_create(comm, new_details);
post.amount.set_commodity(*new_comm);