GnuCash
Contact   Instructions
Bug 798100 - Equity totals calculating incorrectly
Summary: Equity totals calculating incorrectly
Status: RESOLVED FIXED
Alias: None
Product: GnuCash
Classification: Unclassified
Component: General (show other bugs)
Version: 4.4
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: general
QA Contact: general
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-24 09:13 EST by Phil
Modified: 2021-01-25 16:05 EST (History)
4 users (show)

See Also:


Attachments
Issue Screen shots, transaction and accounts pages (258.98 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2021-01-24 09:13 EST, Phil
no flags Details

Description Phil 2021-01-24 09:13:45 EST
Created attachment 373984 [details]
Issue Screen shots, transaction and accounts pages

I am using a mac with High sierra 10.13.6 with GNUcash 4.40, I am looking to replace  paid for software with GNUcash so I am in the initial set up process when I came across this issue that looks very similar to the one reported here.

I created an investment account hierarchy, this auto generated an opening balance account in the equity sub account in the Hierarchy.

I then entered a transaction for the opening balance, the investment account looked correct, the opening balance account looked correct, however the equity total was completely incorrect, it is infact the cash amount multiplied by the calculated price and not the number of shares multiplied by the price.

I deleted the transaction and re entered it, while the trancnsaction looks the same and the investment account looks the same, the opening balance account now shows all zeros.

Attachments of the transaction entered and the two views of the account overview for reference.

The first time I entered the transaction, although it looked the same as the example the actual total amount was set as the number of shares rather than the calculated value.

While I cannot confirm that entered the individual fields in the same order each time the result was the same each time.
Comment 1 John Ralls 2021-01-24 14:53:08 EST
The problem is that Equity accounts aren't allowed to be denominated in non-currency commodities, but that restriction is enforced in the UI code instead of the engine code, so https://github.com/Gnucash/gnucash/pull/762 was able to do it anyway. The register code also has the restriction so you can't enter the shares in the opening balance split; the roll-up in the first screen shot is therefore correct: The share amount in the opening balance split *is* 0.

I wasn't able to create an opening balance transaction from the stock account's creation dialog, it was correctly disabled because non-currency accounts aren't allowed to have opening balances. How did you create the entry with a share balance?
Comment 2 John Ralls 2021-01-24 15:05:21 EST
Ralf Habacker, the underlying problem is https://github.com/Gnucash/gnucash/pull/762/commits/2bdc7dd1c9bbad343f16d4045a738a7ba27286a7 doesn't make sure that xaccAccountGetCommodity(account) returns a currency. I'll fix that, but do any of the changes you made to the account templates violate the restriction?
Comment 3 John Ralls 2021-01-25 16:05:19 EST
I've fixed both creating O.B. accounts for non-currency commodities and creating O.B. accounts unnecessarily for 4.5.

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