summaryrefslogtreecommitdiff
path: root/src/amount.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2010-06-03 17:59:43 -0400
committerJohn Wiegley <johnw@newartisans.com>2010-06-03 17:59:43 -0400
commite8bf3da053e7e1aa2aae01f179d94be414a62ff1 (patch)
treec1ed4073e35b59df4f9128b84b159f41060d0468 /src/amount.cc
parente6c5837b2ca85363b9dc5255592ca5e9da8900e1 (diff)
downloadfork-ledger-e8bf3da053e7e1aa2aae01f179d94be414a62ff1.tar.gz
fork-ledger-e8bf3da053e7e1aa2aae01f179d94be414a62ff1.tar.bz2
fork-ledger-e8bf3da053e7e1aa2aae01f179d94be414a62ff1.zip
Short-circuit annotated commodity valuation
Diffstat (limited to 'src/amount.cc')
-rw-r--r--src/amount.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/amount.cc b/src/amount.cc
index bcd4bb8c..d9b7c82c 100644
--- a/src/amount.cc
+++ b/src/amount.cc
@@ -737,7 +737,9 @@ amount_t::value(const bool primary_only,
#endif
if (has_commodity() &&
(! primary_only || ! commodity().has_flags(COMMODITY_PRIMARY))) {
- if (in_terms_of && commodity() == *in_terms_of) {
+ if (in_terms_of &&
+ (commodity() == *in_terms_of ||
+ commodity().referent() == in_terms_of->referent())) {
return *this;
}
else if (has_annotation() && annotation().price &&