Replace multiple-responsibility function in the wrong class with a
single-responsibility function in the right class.
Changes the signature of a couple of PageStockValue functions.
Setting happens via callbacks and they were handed direct access
to the member variables so the validation wasn't happening.
Validation also requires a logger and passing that to the callbacks
would be hard.
It's StockEntry's responsibility not Model's. This lets us remove
the model parameter from PageStockAmount::prepare. It also requires
that we use StockEntry's set_amount method instead of just setting
m_amount it StockAssistantTest::instantiate_model.
Cash in lieu must be reported as a separate transaction. There was
already a note about that in reverse splits, apply it to regular
splits.
Add suggestion to enter a placeholder number when one can't
immediately calculate the capital gain on a sale or cover buy.
* Get the sign right when calculating new shares
* Fix displaying values and units on the summary page
* Don't display "missing" for values when the user skips
entering a 0 value.
* Create the Stock-account's fees split (when capitalizing)
and cap-gains split.
Substantially simplifies the code by reducing the needed indirection.
In most cases the StockTransactionEntry has everything the page needs
and can be passed as a parameter, further simplifying the code.
Requires moving some parameters around so we can initialize it
correctly:
All of the view's pages need to take an Account* and get its commodity
or currency in their ctors, and creation of the builder has to move to
gnc_stock_transaction_assistant and get passed in.
Caused by trying to set the account on the blank split. The blank split
was present because the method used to clear the split list for the
receiving transaction in gnc_float_txn_to_txn_swap_accounts only removed
splits that belong to the transaction, and the blank split doesn't.
Adds new function xaccTransClearSplits to do a more thorough job.
Also improve the documentation for xaccSplitDestroy to better explain when
a transaction will be destroyed if it empties the split list.
# Please enter the commit message for your
changes. Lines starting
Don't use TransGetCurrency/SplitValue to show payment details. They
may convert to the user's home currency. Use SplitAccount's and
SplitAmount to show the payment details in the APAR currency.
XML_EXPORT_TRANS uses info->csva.account_list. XML_EXPORT_REGISTER
doesn't use an account list, and uses the register QofQuery
instead. Call account_splits once with a nullptr account.
- Balancing lots always involves splits in the same account. So
the relevant number to use in the calculations is the split
amount, not the split value.
- Additionally don't assume transactions are single-currency.
So if amounts change, recalculate the associated values
based on deduced exchange rates.
- Finally if the lot balancing resulted in a split to be broken up
into two splits use conservative calculations for the new
splits' values to avoid introducing imbalances due to
rounding errors.
when comparing two GncTreeIter, if they both were end() iterators from
differing GtkTreeModels they would have been deemed equal. Amend so
that operator== returns false.
Some themes add additional pixels to list rows and dialogs, in this
case with 'TraditionalOK' 2 pixels are added to each entry in the
list and 2 to the popup. This make the calculation for the pop up
height wrong and so when compared to the allocation height it is
different so tries to resolve by re-poping the list and this
cuases an endless loop.
To fix this, use the calculated height which works for Adwaita but
if this is different to the popup allocation height use that.