diff options
author | John Wiegley <johnw@newartisans.com> | 2012-03-20 04:56:03 -0500 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2012-03-20 04:56:03 -0500 |
commit | e3248ee5a6b2c29e1c35eb0315fd66370a117784 (patch) | |
tree | b394d8045e8e524d3dc7c6c6efd9fe865756e994 /src | |
parent | 446beee376ecfd5371335ac99cd287fc26851006 (diff) | |
download | fork-ledger-e3248ee5a6b2c29e1c35eb0315fd66370a117784.tar.gz fork-ledger-e3248ee5a6b2c29e1c35eb0315fd66370a117784.tar.bz2 fork-ledger-e3248ee5a6b2c29e1c35eb0315fd66370a117784.zip |
Fix problems with <Adjustment> postings
Diffstat (limited to 'src')
-rw-r--r-- | src/annotate.cc | 3 | ||||
-rw-r--r-- | src/commodity.cc | 2 | ||||
-rw-r--r-- | src/filters.cc | 9 | ||||
-rw-r--r-- | src/temps.cc | 8 | ||||
-rw-r--r-- | src/temps.h | 3 |
5 files changed, 18 insertions, 7 deletions
diff --git a/src/annotate.cc b/src/annotate.cc index 25f0e582..98635ad7 100644 --- a/src/annotate.cc +++ b/src/annotate.cc @@ -328,7 +328,8 @@ 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.value_expr && + ! details.has_flags(ANNOTATION_VALUE_EXPR_CALCULATED))) { new_comm = pool().find_or_create (referent(), annotation_t(keep_price ? details.price : none, diff --git a/src/commodity.cc b/src/commodity.cc index 5335d8a8..51b8f29c 100644 --- a/src/commodity.cc +++ b/src/commodity.cc @@ -221,6 +221,8 @@ commodity_t& commodity_t::nail_down(const expr_t& expr) { annotation_t new_details; new_details.value_expr = expr; + new_details.add_flags(ANNOTATION_VALUE_EXPR_CALCULATED); + commodity_t * new_comm = commodity_pool_t::current_pool->find_or_create(symbol(), new_details); return *new_comm; diff --git a/src/filters.cc b/src/filters.cc index 02dc392b..58e5fcaf 100644 --- a/src/filters.cc +++ b/src/filters.cc @@ -340,9 +340,10 @@ namespace { const bool act_date_p = true, const value_t& total = value_t(), const bool direct_amount = false, - const bool mark_visited = false) + const bool mark_visited = false, + const bool bidir_link = true) { - post_t& post = temps.create_post(*xact, account); + post_t& post = temps.create_post(*xact, account, bidir_link); post.add_flags(ITEM_GENERATED); // If the account for this post is all virtual, then report the post as @@ -566,7 +567,9 @@ bool display_filter_posts::output_rounding(post_t& post) /* date= */ date_t(), /* act_date_p= */ true, /* total= */ precise_display_total, - /* direct_amount= */ true); + /* direct_amount= */ true, + /* mark_visited= */ false, + /* bidir_link= */ false); } } if (show_rounding) diff --git a/src/temps.cc b/src/temps.cc index cb471d41..881077f6 100644 --- a/src/temps.cc +++ b/src/temps.cc @@ -81,7 +81,8 @@ post_t& temporaries_t::copy_post(post_t& origin, xact_t& xact, return temp; } -post_t& temporaries_t::create_post(xact_t& xact, account_t * account) +post_t& temporaries_t::create_post(xact_t& xact, account_t * account, + bool bidir_link) { if (! post_temps) post_temps = std::list<post_t>(); @@ -93,7 +94,10 @@ post_t& temporaries_t::create_post(xact_t& xact, account_t * account) temp.account = account; temp.account->add_post(&temp); - xact.add_post(&temp); + if (bidir_link) + xact.add_post(&temp); + else + temp.xact = &xact; return temp; } diff --git a/src/temps.h b/src/temps.h index f41c487c..daa1493b 100644 --- a/src/temps.h +++ b/src/temps.h @@ -66,7 +66,8 @@ public: } post_t& copy_post(post_t& origin, xact_t& xact, account_t * account = NULL); - post_t& create_post(xact_t& xact, account_t * account); + post_t& create_post(xact_t& xact, account_t * account, + bool bidir_link = true); post_t& last_post() { return post_temps->back(); } |