From e8bf3da053e7e1aa2aae01f179d94be414a62ff1 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Thu, 3 Jun 2010 17:59:43 -0400 Subject: Short-circuit annotated commodity valuation --- src/amount.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/amount.cc') 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 && -- cgit v1.2.3