diff options
author | John Wiegley <johnw@newartisans.com> | 2010-06-21 17:44:19 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2010-06-21 17:44:19 -0400 |
commit | d792cc0ffce53dd84bbce688e6008c8a77b6065d (patch) | |
tree | 44b3f3e092bb64700997c407e5c1268f6216ca00 /src/xact.cc | |
parent | fcfa491485efececdea05617e6498e43e235b702 (diff) | |
download | fork-ledger-d792cc0ffce53dd84bbce688e6008c8a77b6065d.tar.gz fork-ledger-d792cc0ffce53dd84bbce688e6008c8a77b6065d.tar.bz2 fork-ledger-d792cc0ffce53dd84bbce688e6008c8a77b6065d.zip |
Corrected a major flaw in the transaction finalizer
When a transaction has two commodities, but also a null posting, no
attempt should be made to resolve the costs in terms of the primary
commodity.
Diffstat (limited to 'src/xact.cc')
-rw-r--r-- | src/xact.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/xact.cc b/src/xact.cc index bf18d5b3..1994d353 100644 --- a/src/xact.cc +++ b/src/xact.cc @@ -173,14 +173,15 @@ bool xact_base_t::finalize() add_post(null_post); } - if (balance.is_balance() && + if (! null_post && balance.is_balance() && balance.as_balance().amounts.size() == 2) { // When an xact involves two different commodities (regardless of how // many posts there are) determine the conversion ratio by dividing the // total value of one commodity by the total value of the other. This // establishes the per-unit cost for this post for both commodities. - DEBUG("xact.finalize", "there were exactly two commodities"); + DEBUG("xact.finalize", + "there were exactly two commodities, and no null post"); bool saw_cost = false; post_t * top_post = NULL; |