summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/pool.cc3
-rw-r--r--src/xact.cc6
-rw-r--r--test/regress/999.test6
3 files changed, 11 insertions, 4 deletions
diff --git a/src/pool.cc b/src/pool.cc
index 4526ac0c..71bfab72 100644
--- a/src/pool.cc
+++ b/src/pool.cc
@@ -267,7 +267,8 @@ commodity_pool_t::exchange(const amount_t& amount,
// Do not record commodity exchanges where amount's commodity has a
// fixated price, since this does not establish a market value for the
// base commodity.
- if (! per_unit_cost.is_realzero() &&
+ if (add_price &&
+ ! per_unit_cost.is_realzero() &&
(current_annotation == NULL ||
! (current_annotation->price &&
current_annotation->has_flags(ANNOTATION_PRICE_FIXATED))) &&
diff --git a/src/xact.cc b/src/xact.cc
index c7a9c6e3..eec4cff3 100644
--- a/src/xact.cc
+++ b/src/xact.cc
@@ -292,9 +292,9 @@ bool xact_base_t::finalize()
_("A posting's cost must be of a different commodity than its amount"));
cost_breakdown_t breakdown =
- commodity_pool_t::current_pool->exchange
- (post->amount, *post->cost, false, ! post->has_flags(POST_COST_VIRTUAL),
- datetime_t(date(), time_duration(0, 0, 0, 0)));
+ commodity_pool_t::current_pool->exchange(
+ post->amount, *post->cost, false, ! post->has_flags(POST_COST_VIRTUAL),
+ datetime_t(date(), time_duration(0, 0, 0, 0)));
if (post->amount.has_annotation() && post->amount.annotation().price) {
if (breakdown.basis_cost.commodity() == breakdown.final_cost.commodity()) {
diff --git a/test/regress/999.test b/test/regress/999.test
new file mode 100644
index 00000000..9865eeed
--- /dev/null
+++ b/test/regress/999.test
@@ -0,0 +1,6 @@
+2012-03-10 My Brother
+ Assets:Brokerage 1000 AAPL (@) $1
+ Income:Gifts Received
+
+test prices
+end test