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 116353 - Transaction Currency from stock registers?
Transaction Currency from stock registers?
Status: VERIFIED FIXED
Product: GnuCash
Classification: Other
Component: Register
git-master
Other Linux
: Normal normal
: ---
Assigned To: David Hampton
Chris Shoemaker
: 125711 162288 306534 388104 456067 (view as bug list)
Depends on:
Blocks: backport
 
 
Reported: 2003-06-30 15:36 UTC by Derek Atkins
Modified: 2018-06-29 20:34 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Set the transaction currency from the price DB (1.69 KB, patch)
2006-02-08 06:51 UTC, Mike Alexander
needs-work Details | Review
Get currency from parent account (1.08 KB, patch)
2006-09-07 03:10 UTC, Mike Alexander
none Details | Review

Description Derek Atkins 2003-06-30 15:36:37 UTC
When you enter a transaction from a stock register, what should the common
currency of the transaction be?  It currently uses the Locale Currency, but
this doesn't always work right.  At least some things don't handle this
properly, e.g.:

;;; WARNING (gnc:get-commodity-totalavg-prices:  Sorry, currency exchange
not yet implemented: $361.00  (buying  19 12415.PA ) =?  EUR 0.00)

So either there needs to be a way to set the 'default currency' for stock
accounts, or this other bug needs to be fixed... (or both!)
Comment 1 Derek Atkins 2004-01-03 04:51:02 UTC
*** Bug 125711 has been marked as a duplicate of this bug. ***
Comment 2 Derek Atkins 2005-01-31 23:22:05 UTC
*** Bug 162288 has been marked as a duplicate of this bug. ***
Comment 3 Mike Alexander 2006-02-08 06:51:49 UTC
Created attachment 58899 [details] [review]
Set the transaction currency from the price DB

If you enter a transaction for a commodity from the commodity's register, this patch attempts to set the currency for the transaction to the currency in which the commodity is traded by looking up a price for the commodity in the price DB.  This solves the problem described here and (more fully) in 125711.  Using the price DB for this seems a bit odd, but I couldn't find any other way to get a currency for the commodity and this, at least, avoids the problem if you have a price for the commodity.
Comment 4 Derek Atkins 2006-02-08 14:54:36 UTC
Thanks.  I'll look at the patch.  Unfortunately it DOESN'T solve it for the case where you do not have a pricedb entry for the commodity (which would be the FIRST transaction you enter!).    A better approach would be to look at the transfer account and set the txn currency to the first currency-based account you can find.  This works without the pricedb entry.

Keep in mind that you COULD have the same stock transacted in multiple currencies.  So just using the pricedb isn't necessarily better.

I think a better approach would be to refrain from setting the txn currency at the onset if the register is a non-currency, and when the txn is actually SAVED you see if you have a txn currency and if you do not you iterate over the splits until you find a currency-based account and set the txn currency then.
Comment 5 Derek Atkins 2006-02-12 20:06:22 UTC
It's possible we could use the patch from bug #143720 to solve this problem.
Comment 6 David Hampton 2006-03-08 06:32:00 UTC
*** Bug 306534 has been marked as a duplicate of this bug. ***
Comment 7 Mike Alexander 2006-09-07 03:10:22 UTC
Created attachment 72361 [details] [review]
Get currency from parent account

This patch is another attempt to solve this problem.  It works for the case where you have a currency based account with subaccounts for non-currency commodities.  When entering a transaction in one of the subaccounts it gets the currency from the parent account.  This is better than my previous patch since it doesn't depend on the price DB being present.  I've been running with this patch for several months and haven't had any problems with it.
Comment 8 PL 2006-12-21 16:52:37 UTC
*** Bug 388104 has been marked as a duplicate of this bug. ***
Comment 9 Derek Atkins 2007-07-11 23:59:39 UTC
*** Bug 456067 has been marked as a duplicate of this bug. ***
Comment 10 Yan Li 2007-11-26 13:56:28 UTC
Any update to this bug recently? I just crash into this bug today (using GnuCash 2.2.1, sold mutual fund shares but the related bank account's deposit column is empty). It cost me 2 hours to track down to this bug (from https://lists.gnucash.org/pipermail/gnucash-user/2003-October/008945.html).

Is it fixed in SVN? Or shall we document this into FAQ if it's really difficult to fix. I think it's quite easy for people to meet this problem: just sell funds or stocks and see it!

Thanks!
Comment 11 Derek Atkins 2007-12-25 16:25:31 UTC
Okay, I just applied something based on the patch in comment #7.  The difference is that it actually walks up the tree instead of only looking at the parent.  It also pops up a dialog if it fails, although I don't see how it could fail unless you have a top-level stock account.

Note that this does not fix bug #106873, and the fix for that would make this fix unnecessary.  But this one was easier to solve.

Committed into trunk as r16718.
Awaiting backport.
Comment 12 Derek Atkins 2007-12-25 16:40:50 UTC
Sorry, re-opened until it gets backported.
Comment 13 Andreas Köhler 2008-01-30 20:04:20 UTC
Oh, actually this has been backported and is available in GnuCash 2.2.3, but missed the release notes.
Comment 14 John Ralls 2018-06-29 20:34:35 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=116353. Please update any external references or bookmarks.