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.
This commit is contained in:
parent
fcfa491485
commit
d792cc0ffc
1 changed files with 3 additions and 2 deletions
|
|
@ -173,14 +173,15 @@ bool xact_base_t::finalize()
|
||||||
add_post(null_post);
|
add_post(null_post);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (balance.is_balance() &&
|
if (! null_post && balance.is_balance() &&
|
||||||
balance.as_balance().amounts.size() == 2) {
|
balance.as_balance().amounts.size() == 2) {
|
||||||
// When an xact involves two different commodities (regardless of how
|
// When an xact involves two different commodities (regardless of how
|
||||||
// many posts there are) determine the conversion ratio by dividing the
|
// many posts there are) determine the conversion ratio by dividing the
|
||||||
// total value of one commodity by the total value of the other. This
|
// total value of one commodity by the total value of the other. This
|
||||||
// establishes the per-unit cost for this post for both commodities.
|
// 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;
|
bool saw_cost = false;
|
||||||
post_t * top_post = NULL;
|
post_t * top_post = NULL;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue