GnuCash
Contact   Instructions
Bug 797277 - Assets over time ignores nested liabilities
Summary: Assets over time ignores nested liabilities
Status: RESOLVED FIXED
Alias: None
Product: GnuCash
Classification: Unclassified
Component: Reports (show other bugs)
Version: 3.5
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: reports
QA Contact: reports
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-10 15:02 EDT by adrian.collister
Modified: 2019-06-20 20:23 EDT (History)
4 users (show)

See Also:


Attachments
Test case datafile (1.33 KB, application/x-gnucash)
2019-06-16 17:22 EDT, adrian.collister
no flags Details

Description adrian.collister 2019-06-10 15:02:38 EDT
I recently upgraded to 3.5 from 3.2, and in the change my Assets over Time report has been broken.

The problem seems to be that I have some asset accounts which have child liability accounts. For example, a property with a mortgage account as a child. The Assets over Time report used to show the net value of that group (i.e. property value less the outstanding mortgage) but now it is just showing the property value.

I've tried adding the mortgage account manually in the report options, but as soon as I press Apply it is automatically deselected again.
Comment 1 adrian.collister 2019-06-11 15:47:30 EDT
I've rolled back progressively, and found that the problem appears between v3.3 and v3.4.
Comment 2 Christopher Lam 2019-06-13 08:18:56 EDT
A minimal test case datafile will be useful.
Comment 3 adrian.collister 2019-06-16 17:22:05 EDT
Created attachment 373300 [details]
Test case datafile

This contains a very simple account hierarchy. Under Assets, there's a Property account with a positive balance of £100,000. That Property account has a child Loan account with a negative balance of £80,000. Thus the net balance of the Property account is positive £20,000.

In both v3.3 and v3.4 an Assets Piechart report (with accounts shown until level 2) shows the Property account with the net balance of £20,000.

However, the Assets over Time report (also with accounts shown until level 2) behaves differently between v3.3 and v3.4. In v3.3 it agrees with the Assets Piechart and shows the Property account with the net £20,000. But in v3.4 it shows the Property account with the gross balance of £100,000.
Comment 4 Christopher Lam 2019-06-17 09:34:49 EDT
Hi Adrian
Thank you for reporting this bug and the test-case.
I can offer a fix, but I am not 100% sure it covers *all* combinations of accounts-selection (including different account-types), account-depth-levels, chart-of-accounts(*) etc. If you could test for me I will be very grateful.

(*) I tend to set up my chart so that Loan accounts are children of a top-level Liability placeholder account rather than the asset account, so I don't use your setup, however I don't think yours is invalid/incorrect...

Fix for category-barchart.scm -- replace lines as follows - delete '-' line and add '+' line, (without the - or +)

Unstaged changes (1)
modified   gnucash/report/standard-reports/category-barchart.scm
@@ -373,7 +373,10 @@ developing over time"))
                                     (not (xaccTransGetIsClosingTxn
                                           (xaccSplitGetParent s))))
                                 (xaccSplitGetAmount s))))))))
-             accounts))
+             (delete-duplicates
+              (append accounts
+                      (filter (lambda (acc) (not (member acc accounts)))
+                              (gnc:acccounts-get-all-subaccounts accounts))))))
 
           ;; Creates the <balance-list> to be used in the function
           ;; below.
Comment 5 Christopher Lam 2019-06-18 11:36:09 EDT
I've pushed fix into the code.

Please test fix as described, or latest maint on https://code.gnucash.org/builds/win32/maint/ tomorrow for the fix. I believe this is the right fix.
Comment 6 adrian.collister 2019-06-20 16:11:31 EDT
Many thanks for the quick fix! Happy to confirm that it is working as expected on my personal data file (tested on the maint build dated 20-Jun-2019).

Note You need to log in before you can comment on or make changes to this bug.