r22737 - gnucash/branches/2.4/src/register/ledger-core - [22673] Use the correct fraction when editing expanded multiple currency transactions.

Mike Alexander mta at code.gnucash.org
Wed Jan 30 01:46:05 EST 2013


Author: mta
Date: 2013-01-30 01:46:05 -0500 (Wed, 30 Jan 2013)
New Revision: 22737
Trac: http://svn.gnucash.org/trac/changeset/22737

Modified:
   gnucash/branches/2.4/src/register/ledger-core/split-register-util.c
Log:
[22673] 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/branches/2.4/src/register/ledger-core/split-register-util.c
===================================================================
--- gnucash/branches/2.4/src/register/ledger-core/split-register-util.c	2013-01-30 05:22:46 UTC (rev 22736)
+++ gnucash/branches/2.4/src/register/ledger-core/split-register-util.c	2013-01-30 06:46:05 UTC (rev 22737)
@@ -344,7 +344,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