summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-06-18 16:10:08 +0100
committerJohn Wiegley <johnw@newartisans.com>2009-06-18 16:10:08 +0100
commit4253c2a35dc3592d9d31a7ebf270ea4fa3c63e38 (patch)
tree821b0ef6ad1b3210a35ff640b74b8c403712f8f3
parent8d97adec7bcba851dcf3e1d659767e7bf8de20ca (diff)
downloadfork-ledger-4253c2a35dc3592d9d31a7ebf270ea4fa3c63e38.tar.gz
fork-ledger-4253c2a35dc3592d9d31a7ebf270ea4fa3c63e38.tar.bz2
fork-ledger-4253c2a35dc3592d9d31a7ebf270ea4fa3c63e38.zip
Allow uncommoditized amounts to be used as costs
-rw-r--r--src/textual.cc8
-rw-r--r--test/regress/86D2BDC4.test12
2 files changed, 19 insertions, 1 deletions
diff --git a/src/textual.cc b/src/textual.cc
index f2996a03..3cf3c13c 100644
--- a/src/textual.cc
+++ b/src/textual.cc
@@ -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);
diff --git a/test/regress/86D2BDC4.test b/test/regress/86D2BDC4.test
new file mode 100644
index 00000000..8cd51e42
--- /dev/null
+++ b/test/regress/86D2BDC4.test
@@ -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