GNOME Bugzilla – Bug 454305
Trial Balance Report: Wrong after negative Stock Split
Last modified: 2018-06-29 21:41:56 UTC
Please describe the problem: After a stock consolidation (negative split), the value of the stock is shown incorrectly in Trial Balance; the difference between correct and displayed value carries through to the total line, resulting in an apparent failure to balance. Steps to reproduce: 1. Create a new file including the "Investment Accounts" group 2. Create a suitable stock account 3. enter a transaction to purchase, say, 500 at 4 each, total 2000 4. Use the Stock Split Wizard to enter a negative split: say, -200, with no cash amount involved. This changes the number of shares held but should not change the total value 5. Invoke a Trial balance report Actual results: Trial Balance report shows value of 857.14 (should be 2000) against the stock; 2000 against whichever account the purchase came from; and these respective amounts in Debit and Credit column totals, for an imbalance of 1142.86. Expected results: Correct amount of 2000 showing against the stock and in the debit column total. Does this happen every time? Yes, provided only that the split is negative. Other information: Playing with the figures shows that the report is apparently trying to calculate a weighted average of the prices in order to revalue the residual stock, but is always adding the number of shares involved in the split (i.e. taking the absolute value). A positive number (i.e. a distribution rather than a consolidation) gives the expected result. Correct calculation: 500 at 4 = 2000 less 200 at 0 = 0 = 300 for 2000 = 6.6667 each Trial Balance: 300 at 6.6667 = 2000 Calculation apparently used: 500 at 4 = 2000 plus 200 at 0 = 0 = 700 for 2000 = 2.85714 each Trial Balance: 300 at 2.85 = 857.14
Created attachment 91305 [details] Sample file showing the problem Uncompressed GnuCash XML file constructed as per description; contains exactly two transactions.
Fix committed in r17339. Requesting backport for 2.2.
Applied to branches/2.2 as r17389 for inclusion in GnuCash 2.2.6. Thanks!
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=454305. Please update any external references or bookmarks.