Severe currency conversion bug when posting business invoices

Mukund Sivaraman muks at banu.com
Fri Nov 18 17:27:21 EST 2011


Hi Geert

On Fri, Nov 18, 2011 at 10:24:01PM +0100, Geert Janssens wrote:
> You have stumbled upon a bug in GnuCash, which has been reported a while back 
> [1]. I don't know of any workaround for this unfortunately.
> [1] https://bugzilla.gnome.org/show_bug.cgi?id=649362

I use the attached patch as a hack for now. It's not the nicest patch,
but works as it gets the currency rate at 6 decimal places which is
about what Finance::Quote does anyway.

Now that that's done, there may be another issue. I wish this whole
topic on multiple currencies / trading account was better documented in
GnuCash's manual. I have read Seligner's articles on it, but they don't
exactly describe the accounts under the 'Trading' subtree in GnuCash.

Anyway here's my new issue:

"Business->Customer->Process Payment" autofills a payment of INR 3000
instead of the INR equivalent of USD 3000. So a payment of about $70 is
processed at the end instead of $3000.

When the correct INR value is auto-filled, I also expect GnuCash to
auto-fill the "To Amount" to $3000 so that by default it shows the
customer has paid in full (and using the INR:USD ratio, it calculates
what the rate of conversion was, perhaps as used by the receiving
bank).

Let's say I have billed my customer for USD 3000 as is in
'test.gnucash'.  I've posted the invoice.  GnuCash adds it to "USD
Accounts Receivable" (a USD account) as USD 3000, and also
"Income:Sales" as INR 154,035.

When a customer pays USD 3000, and that gets to my local bank account
as INR 154,000, I can ask GnuCash to accept that as a payment of USD
3000 (for the entry in "USD Accounts Receivable", so that payment for
that entry is marked as being completely received).

There is a difference of INR 35:

* USD Accounts Receivable" now shows USD 0.
* "Assets:Savings Account" shows a balance of INR 154,000.
* "Income:Sales" shows a balance of INR 154,035.
* Trading shows:
  o INR: 35
  o USD: 0

The 35 under Trading:INR is positive.  How do I make sense of that +35?

Hence, I wish this was better documented. :) I use GnuCash for personal
accounting (in a single currency) and it works so well I'd like to use
it for my small business (where proper support for multiple currencies
is required).

		Mukund
-------------- next part --------------
>From 46971d0c4d4caf09761929a6729d3a687eb9ac9b Mon Sep 17 00:00:00 2001
From: Mukund Sivaraman <muks at banu.com>
Date: Sat, 19 Nov 2011 03:37:56 +0530
Subject: [PATCH] Compute the exchange rate for amount=10000000 instead of
 amount=1

---
 src/business/business-gnome/dialog-invoice.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/business/business-gnome/dialog-invoice.c b/src/business/business-gnome/dialog-invoice.c
index a219a5e..ba099d5 100644
--- a/src/business/business-gnome/dialog-invoice.c
+++ b/src/business/business-gnome/dialog-invoice.c
@@ -781,8 +781,8 @@ gnc_invoice_window_postCB (GtkWidget *widget, gpointer data)
                 XferDialog *xfer;
                 gnc_numeric exch_rate;
                 Timespec date;
-                gnc_numeric amount = gnc_numeric_create(1, 1);
 
+                gnc_numeric amount = gnc_numeric_create(10000000, 1);
 
                 /* create the exchange-rate dialog */
                 xfer = gnc_xfer_dialog (iw_get_window(iw), this_acc);
-- 
1.7.7.1



More information about the gnucash-user mailing list