The register split transaction UI will create invalid autofill values when multiple currencies are involved. This was found by following the GnuCash Guide section 12.4. 'Recording Purchases in a Foreign Currency'. ===Setup Windows 10 v1903 GnuCash 2.6.21 or GnuCash 3.5 (reproduces in both) ===Repo (these are based on Guide section 12.4 + trading account) 1. Create new GnuCash file with... USD based Trading accounts enabled Template accounts of both 'common' and 'investment' Apply and save 2. Create new account under 'Assets:Current Assets' Name = Jam Bank Currency = JMD 3. Open register for 'Assets:Current Assets:Checking Account' 4. New tx Date= 1/1/2019 Description= Opening Balance Transfer= Equity:Opening Balances Deposit= 100000.00 5. New tx Date= 4/1/2019 Description= transfer to jam (click split in the toolbar) Split 1 Account= Assets:Current Assets:Checking Account (autofill default) Split 1 Withdrawal= 10000.00 Split 2 Account= Expenses:Bank Service Charge (Tab to Deposit column) (type 150.00) (press tab twice) (** notice that autofill has entered 9,850.00 already **) Split 3 Account= Assets:Current Assets:Jam Bank (press tab) (nothing to change as I want the full USD 9850.00 to be transfered) (press enter) 6. The Transfer funds dialog appears 7. Ignore the known issue of reversed to/from USD/JMD fields and the need to enter the inverted exchange rate. 8. Enter the inverted exchange rate of: 1/64 9. Press OK ===Result An Imbalance-USD and an incorrect J$9,850 in the Jam Bank account. ===Expected No imbalance and J$634,400 in the Jam Bank account. ===Notes This errant behavior is due to at least two things: 1) Register Autofill pre-populating 9,850.00. To the user, that is exactly what they expect and want in the account register's local currency of USD. However, the error here is that the field expects J$ but the autofill provided USD. 2) The cascade of confusing UI in the register and the following transfer/exchange dialog when trading account are enabled. This often displays believable values. Technically, the math is correct and no data is lost. However, the combination of a "wrong" autofill and the known issues of the register's UI with trading accounts leads to errant results which are difficult to resolve. ===Idea Resolving the overall UI issues with register and transfer/exchange dialog with trading accounts enabled is a separate and large-in-scope issue. I recommend that be separate. Instead, perhaps there is a small isolated UI change that can deal with this errant autofill behavior. Perhaps the code could... 1) Only trigger this logic when trading accounts are enabled 2) Only trigger when it is a split 3) Only trigger when the destination account of a transfer is a different currency than the local register 4) Clear/remove any autofill value already populated 5) Put the currency symbol of the destination account in the amount field.
Related to: https://bugs.gnucash.org/show_bug.cgi?id=658494 https://bugs.gnucash.org/show_bug.cgi?id=796545