Severe currency conversion bug when posting business invoices

Mukund Sivaraman muks at banu.com
Fri Nov 18 13:48:11 EST 2011


Hi all

I am evaluating GnuCash for my small business.  I have stumbled upon a
reproducible bug and here's a complete report including how to
reproduce it, screenshots and a testcase file.

I am in India (default currency = INR). My customer is in the US
(currency/security = USD).

In my book options, "Use trading accounts" is checked. I've created an
invoice for the customer in USD.  The income account for the invoice
entries is "Income:Sales" (INR account).  Invoices gets posted to the
"Assets:Accounts Receivable:USD A/Receivable" account (USD account). 
Accounts under "Trading" are automatically setup, and I don't touch
them.

I have configured the currency rate as 50.9451 INR / USD using the
Price Editor for the USD security.

Here's a sample invoice in the editor (also available in the testcase
file below):

https://malgudi.org/~muks/tmp/gc-invoice.png

The bug is, that when the invoice is posted, neither the manually
entered price nor the price downloaded by Finance::Quote is correctly
used.  What seems to happen is that 1 INR is converted to USD by the
code in XferDialog and rounded to 2 decimal places.  1 INR in USD is
computed as 0.02:

https://malgudi.org/~muks/tmp/gc-transfer-dialog.png

A reciprocal of this seems to be used for the 1 USD to 1 INR
conversion, which results in 1 USD = 1/0.02 = 50.00 INR.  This is
further set as a new price.

https://malgudi.org/~muks/tmp/gc-price-editor-before.png
https://malgudi.org/~muks/tmp/gc-price-editor-after.png

This bug is severe as if you're converting USD 2000 to INR, you're off
the mark by > INR 2000.

Furthermore, if Finance::Quote has been used from the Price Editor to
fetch and set a price just before posting the invoice, both the
A/Receivable account and Income:Sales account use _different_ prices,
going out of sync immediately.  Trading in the tree shows RED.

https://malgudi.org/~muks/tmp/gc-main-window.png

For anyone who wants to reproduce this issue quickly, here's the
testcase gnucash file:

https://malgudi.org/~muks/tmp/test.gnucash

I can reproduce this with both trunk and 2.4.8 on Fedora 16.

Any workarounds/fixes are much appreciated, as I want to put GnuCash to
use.

		Mukund


More information about the gnucash-user mailing list