Use the correct fraction when editing expanded multiple currency transactions.

When a transaction is expanded and trading accounts are in use, the debit
and credit cells contain values in the split's commodity not the transaction's
currency.  For example if you have a transaction involving JPY and USD
currencies and the transaction's currency is JPY, you can only enter whole
dollar amounts in the USD splits.  This fixes this problem.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22673 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Mike Alexander 2012-12-19 05:34:48 +00:00
parent 40fd5ccd5c
commit ba9b85a260

View File

@ -345,7 +345,19 @@ gnc_split_register_set_cell_fractions (SplitRegister *reg, Split *split)
int fraction;
trans = xaccSplitGetParent (split);
currency = xaccTransGetCurrency (trans);
if (gnc_split_register_current_trans_expanded (reg) &&
xaccTransUseTradingAccounts (trans))
{
/* If the transaction is expanded and using trading accounts then
* the debit and credit fields are in the split's commodity not
* the transaction's currency
*/
currency = xaccAccountGetCommodity (xaccSplitGetAccount (split));
}
else
{
currency = xaccTransGetCurrency (trans);
}
if (!currency)
currency = gnc_default_currency ();