diff options
author | Daraul Harris <thurst306@gmail.com> | 2020-12-05 14:43:21 +0800 |
---|---|---|
committer | Martin Michlmayr <tbm@cyrius.com> | 2020-12-05 15:14:13 +0800 |
commit | 051e4ab1ef82c58dc9563281ec14c02fc250e20f (patch) | |
tree | 868160d22df0adeac9ee0e2462ccae1543009d34 /src | |
parent | 94b692a9bcfccf7d60c85321bd7e358956fdf6e4 (diff) | |
download | fork-ledger-051e4ab1ef82c58dc9563281ec14c02fc250e20f.tar.gz fork-ledger-051e4ab1ef82c58dc9563281ec14c02fc250e20f.tar.bz2 fork-ledger-051e4ab1ef82c58dc9563281ec14c02fc250e20f.zip |
Do not treat balance assignments with 0 diff as a null posting
Ledger is treating balance assignments that have a 0 diff as having
a null posting, leading to the posting being auto-balanced and
therefore causing incorrect values to be returned for the transaction.
I fixed this by just making the posting equal to amt - amt (0 in the
right commodity).
Fixes #1942
Diffstat (limited to 'src')
-rw-r--r-- | src/textual.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/textual.cc b/src/textual.cc index b4e51fbe..70bf4129 100644 --- a/src/textual.cc +++ b/src/textual.cc @@ -1705,7 +1705,11 @@ post_t * instance_t::parse_post(char * line, // as amount cannot store more than 1 commodity. post->amount = diff.to_amount(); DEBUG("textual.parse", "line " << context.linenum << ": " - << "Overwrite null posting"); + << "Overwrite null posting with " << diff.to_amount()); + } else { + post->amount = amt - amt; // this is '0' with the correct commodity. + DEBUG("textual.parse", "line " << context.linenum << ": " + << "Overwrite null posting with zero diff with " << amt - amt); } } else { // balance assertion |