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.
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?
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?
I've fixed both creating O.B. accounts for non-currency commodities and creating O.B. accounts unnecessarily for 4.5.