From 3c0caf1100b2ea93ae46e7642cc8a8ecfa477a33 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sat, 4 Mar 2006 17:20:22 +0000 Subject: [PATCH] *** empty log message *** --- journal.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/journal.cc b/journal.cc index 7c1aeac5..0f14d7d6 100644 --- a/journal.cc +++ b/journal.cc @@ -146,7 +146,8 @@ bool entry_base_t::finalize() if (this_bal == other_bal) other_bal++; - amount_t per_unit_cost = (*other_bal).second / (*this_bal).second; + amount_t per_unit_cost = + amount_t((*other_bal).second / (*this_bal).second).unround(); for (; x != transactions.end(); x++) { if ((*x)->cost || ((*x)->flags & TRANSACTION_VIRTUAL) || @@ -157,12 +158,11 @@ bool entry_base_t::finalize() balance -= (*x)->amount; entry_t * entry = dynamic_cast(this); - if ((*x)->amount.commodity().annotated) - throw error("Cannot self-balance an annotated commodity"); - - (*x)->amount.annotate_commodity(abs(per_unit_cost), - entry ? entry->actual_date() : 0, - entry ? entry->code : ""); + + if (! (*x)->amount.commodity().annotated) + (*x)->amount.annotate_commodity(abs(per_unit_cost), + entry ? entry->actual_date() : 0, + entry ? entry->code : ""); (*x)->cost = new amount_t(- (per_unit_cost * (*x)->amount)); balance += *(*x)->cost;