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 715123 - Post invoice problem, cannot unpost
Post invoice problem, cannot unpost
Status: RESOLVED FIXED
Product: GnuCash
Classification: Other
Component: Business
2.4.x
Other Windows
: Normal major
: ---
Assigned To: gnucash-core-maint
gnucash-core-maint
Depends on:
Blocks:
 
 
Reported: 2013-11-24 19:39 UTC by Bastiaan
Modified: 2018-06-29 23:21 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
testcase (165.01 KB, application/octet-stream)
2013-11-24 19:39 UTC, Bastiaan
Details

Description Bastiaan 2013-11-24 19:39:40 UTC
Created attachment 261367 [details]
testcase

Since version 2.4.0 there is a problem posting invoices in files created in older versions. I could not find the steps to reproduce this from scratch, but attached is a file stripped down as far as I could, which exhibits the problem. I have been using GnuCash since 2006.

Try to post an invoice (e.g. with id 113). When done, the Post button is still enabled and the Unpost disabled, and no "post date" is shown. You can still delete rows. There is however no empty entry at the end of the invoice, and when searching for posted invoices this invoice shows up. So part of GnuCash sees this as posted, the other doesn't.

Versions up to 2.2.9 do not have this problem.

Here is a thread that may be related: http://gnucash.1415818.n4.nabble.com/Unpost-Invoice-When-Allowed-td1434951.html

A bug fix would be great, but if I just could edit the file so that it works with versions 2.4.x then that would be fine as well. Otherwise I will be stuck at 2.2.9 forever...


Thanks for an otherwise great product!
Comment 1 Geert Janssens 2013-12-02 21:46:34 UTC
Thank you for your bug report. I can easily reproduce the problem with your test case. Wonderful.

I haven't fully figured out the root cause yet, but my first analysis suggests a flaw in the business code where the accounts in the tax table use a different currency than the entries they are used with (or rather, the currency for the invoice in general).

I don't have a system on which I can easily install gnucash 2.2.9 so I'll ask: when you post these invoices in gnucash 2.2.9, does gnucash ask for a conversion rate between NOK and EUR ?
Comment 2 Derek Atkins 2013-12-02 22:10:59 UTC
I am pretty sure that 2.2.x does not support multi-currency invoices.  I think the "ask for conversion rate" was added for 2.4.
Comment 3 Bastiaan 2013-12-03 09:09:27 UTC
Indeed, it does not ask for a conversion rate when posting in 2.2.9.

By the way, if no taxes apply (this is export) I hope not to be asked for a conversion rate in 2.4 either...

Thanks for looking into this. Being able to send invoices in foreign currencies is the single biggest "selling" point for me :)
Comment 4 Derek Atkins 2013-12-03 15:12:39 UTC
(In reply to comment #3)
> Indeed, it does not ask for a conversion rate when posting in 2.2.9.
> 
> By the way, if no taxes apply (this is export) I hope not to be asked for a
> conversion rate in 2.4 either...
> 
> Thanks for looking into this. Being able to send invoices in foreign currencies
> is the single biggest "selling" point for me :)

Yes, you can send invoices in foreign currencies, HOWEVER:

a) All Accounts associated with the Invoice MUST be in the same foreign currency, and 
b) All Accounts associated with paying the Invoice MUST also be in the same foreign currency.

This means that you need a unique A/R account for each currency, you need unique Income and Expense accounts for each currency, you need a unique Asset (Bank) account for each currency, and you must manually assure that you use the correct ones consistently for each Invoice based on the Customer Currency that was in place when you selected the Customer for the Invoice.

It sounds like you are NOT doing something consistently.
Comment 5 Geert Janssens 2013-12-03 16:15:01 UTC
Just to be clear, these restrictions are for 2.2.9. And the test data shows you violate these restrictions via the tax table you have associated with the invoice's entries. That table still uses an account in NOK, while the invoice is in EUR.

For 2.4+ the code has been adapted to deal with different currencies between invoices and associated accounts. You still need a unique A/R account per currency though.

However your bug report revealed there's a hole in this code that doesn't check currency of the accounts in the tax tables. The code only notices much later it is lacking a conversion rate, but at that point it can't interact with the user anymore, so it simply bails out leaving the invoice unposted.

I think the code should at least have printed a warning in the trace file at that point. This is not directly visible to the user, but at least a developer would have gotten a clue immediately where it went wrong.

But the complete solution would be to check accounts in the tax tables as well for non-matching currencies, and ask the user a conversion rate for those as well.
Comment 6 Geert Janssens 2013-12-04 17:05:17 UTC
I have pushed a fix to the development branch (r23485). I tried to backport the fix, but the code has changed too much in that area to still work.

So in 2.4 you won't be able to post invoices with tax tables referring to accounts in a different currency than the invoice itself. In 2.6 you will be able to do this properly.

(In reply to comment #3)
> 
> By the way, if no taxes apply (this is export) I hope not to be asked for a
> conversion rate in 2.4 either...
> 
With the example book you have attached to this bug you will be asked for a conversion rate in 2.6 even if the tax amounts are 0. That is because GnuCash requires a conversion rate whenever it creates a transaction between accounts in a different currency even if the amount is 0.

If you don't want this to happen, then don't set a tax table. Then GnuCash won't try to create a transaction for it and hence won't ask for an exchange rate. You could have done this for your current data already as well.
Comment 7 Bastiaan 2013-12-04 23:10:36 UTC
Excellent. Many thanks for the great help and explanations. I will migrate to 2.4 soon because I like what I have seen so far :)

Bastiaan.
Comment 8 John Ralls 2018-06-29 23:21:50 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=715123. Please update any external references or bookmarks.