Allow uncommoditized amounts to be used as costs

This commit is contained in:
John Wiegley 2009-06-18 16:10:08 +01:00
parent 8d97adec7b
commit 4253c2a35d
2 changed files with 19 additions and 1 deletions

View file

@ -969,8 +969,14 @@ post_t * instance_t::parse_post(char * line,
post->cost->in_place_unround();
if (per_unit)
if (per_unit) {
// For the sole case where the cost might be uncommoditized,
// guarantee that the commodity of the cost after multiplication
// is the same as it was before.
commodity_t& cost_commodity(post->cost->commodity());
*post->cost *= post->amount;
post->cost->set_commodity(cost_commodity);
}
DEBUG("textual.parse", "line " << linenum << ": "
<< "Total cost is " << *post->cost);

View file

@ -0,0 +1,12 @@
reg -B
<<<
2009/06/03 Westjet
Expenses:Transportation:Air C$429.80 @ 1.572865
Expenses:Bank:Fees 2.73
Liabilities:Mastercard
>>>1
09-Jun-03 Westjet Ex:Transportation:Air 676.017377 676.017377
Expenses:Bank:Fees 2.73 678.747377
Liabilities:Mastercard -678.747377 0
>>>2
=== 0