After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 333572 - [Patch] Currency exchange rates are not downloaded correctly
[Patch] Currency exchange rates are not downloaded correctly
Status: VERIFIED FIXED
Product: GnuCash
Classification: Other
Component: General
git-master
Other All
: Normal normal
: ---
Assigned To: David Hampton
Chris Lyttle
Depends on:
Blocks:
 
 
Reported: 2006-03-06 06:43 UTC by Mike Alexander
Modified: 2018-06-29 20:59 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to fix these problems (2.95 KB, patch)
2006-03-06 06:45 UTC, Mike Alexander
none Details | Review

Description Mike Alexander 2006-03-06 06:43:35 UTC
Please describe the problem:
If you use "Get Quotes" to download prices, currency exchange rates are not downloaded.  In Gnucash 
1.8 the flag that caused prices to be downloaded was set in the the account that contained the 
commodity in question.  In 1.9 it has been moved to a more logical place in the dialog used to edit the 
commodity itself.  However there is no way to edit a currency as a commodity so there is no way to set 
this flag.  However, there is a kluge in xaccAccountSetCommodity that says to download exchange rates 
for any currency that is used in any account. Unfortunately this kluge isn't quite right.  It sets the flag to 
get quotes, but neglects to set a quote source.

Even with the quote source set, things don't work right since the quote source for currency quotes has 
"currency" as the name, but the the code fetching the quotes is looking for CURRENCY.

With these two bugs fixed GC 1.9 downloads exchange rates ok, but if you save a file in 1.9 it loses the 
flags that cause 1.8 to download exchange rates.  The code in gnc_account_dom_tree_create that saves 
this flag won't save it for a currency even if the account is a currency account.

There is one last bug I found in this code.  If you use --add-price-quotes to download quotes without a 
GUI, GC 1.9 downloads an exchange rate to convert the default currency to itself.  It always gets 1 
(fortunately) but it shouldn't be doing this.  This happens because gnc:url->loaded-session which is 
used to load the file in this case gets a new session to load the file, but does not make it the default 
session.  This means that we have two definitions of the default currency, one in the session used to 
load the file and the other in the default session created implicitly.  These two never match so it always 
downloads the exchange rate for converting the default currency into itself.

Steps to reproduce:
1. Create a file with accounts in more than one currency
2. Use "Get Quotes" to download quotes
3. Observe that you don't get currency exchange rates

Actual results:
I don't get any exchange rates

Expected results:
Exchange rates for converting all currencies used in the file into the default currency should be 
downloaded

Does this happen every time?
Yes

Other information:
I have a patch that fixes these problems which I will attach to this bug report.  With these changes 
gnucash 1.9 downloads exchange rates properly and doesn't clobber the flag that tells version 1.8 to 
do so.
Comment 1 Mike Alexander 2006-03-06 06:44:22 UTC
Sorry about the line wrapping.  I don't know what caused that.
Comment 2 Mike Alexander 2006-03-06 06:45:50 UTC
Created attachment 60741 [details] [review]
Patch to fix these problems
Comment 3 Christian Stimming 2006-03-06 09:20:51 UTC
Thanks for providing the patch.
Comment 4 Bengt Thuree 2006-03-29 11:23:22 UTC
Confirming I have the same problem, and installing this patch resolved the issue for me.
Comment 5 David Hampton 2006-04-01 05:46:15 UTC
Applied as r13723.  Thanks for the cleanup work on currencies.
Comment 6 John Ralls 2018-06-29 20:59:04 UTC
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=333572. Please update any external references or bookmarks.