r22673 - gnucash/trunk/src/register/ledger-core - Use the correct fraction when editing expanded multiple currency transactions.

Mike Alexander mta at code.gnucash.org
Wed Dec 19 00:34:48 EST 2012


Author: mta
Date: 2012-12-19 00:34:48 -0500 (Wed, 19 Dec 2012)
New Revision: 22673
Trac: http://svn.gnucash.org/trac/changeset/22673

Modified:
   gnucash/trunk/src/register/ledger-core/split-register-util.c
Log:
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.

Modified: gnucash/trunk/src/register/ledger-core/split-register-util.c
===================================================================
--- gnucash/trunk/src/register/ledger-core/split-register-util.c	2012-12-18 18:10:57 UTC (rev 22672)
+++ gnucash/trunk/src/register/ledger-core/split-register-util.c	2012-12-19 05:34:48 UTC (rev 22673)
@@ -345,7 +345,19 @@
     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 ();
 



More information about the gnucash-changes mailing list