Erroneous behaviour of "Duplicate Invoice" feature in 2.4.2 (fixed in SVN and upcoming 2.4.3)

Christian Stimming stimming at tuhh.de
Wed Feb 9 16:33:25 EST 2011


Dear all,

the new "Duplicate Invoice" feature introduced into SVN on 2011-01-16 and 
newly available in version 2.4.2 unfortunately has a bug, which has been fixed 
today in SVN (r20260) and the fix will be in 2.4.3.

The problem is that the newly created invoice erroneously has no internal 
currency set. This causes unexpected behaviour of the tax amount calculations 
- the values will be off by fractions of a cent and it might appear impossible 
to get the invoice lines sum up to a normal correct amount. When posting this 
sort of invoice, there will be a weird warning text saying "One or more of
the entries are for accounts different from the invoice/bill currency. You 
will be asked for an exchange rate for each."

Workaround #1: Don't use the "Duplicate Invoice" feature in version 2.4.2, it 
is broken. (Sorry for that.) It will be fixed in version 2.4.3.

Workaround #2: If you already have created invoices this way which you need to 
have fixed, you have to manually edit the XML file with a text editor. There 
isn't any easier way to fix those. 

Here are the instructions for fixing an example invoice with the number 
"01234":

1. Save your XML file in uncompressed mode: In GnuCash, click "Edit" -> 
"Preferences", then the "General" tab, then un-check the check mark at the 
setting "Compress File". Then "Save" your file.
2. Copy your existing file to some other location so that you have a backup 
file in case anything goes wrong below.
3. Open the file with some text editor.

4. Do a text search for the string with your invoice number "01234". If the 
number isn't unique enough, you have to search for the number enclosed by the 
<invoice:id> XML tag, which means the full search string is 
"<invoice:id>01234</invoice:id>". You should notice that the file contains 
only exactly one line with this content, and it's enclosed by a 
<gnc:GncInvoice>...</gnc:GncInvoice> top-level XML tag. In the erroneous 
invoices, there is no sub-tag labeled <invoice:currency> a few lines below, 
whereas in correct invoices, there is such a sub-tag.

5. Right after this <invoice:id> line, insert the following four lines:

  <invoice:currency>
    <cmdty:space>ISO4217</cmdty:space>
    <cmdty:id>USD</cmdty:id>
  </invoice:currency>

This sets the currency into the invoice and from then on it will behave 
correctly again. Of course instead of "USD" you need to insert the actual 
currency you intend to use, e.g. "EUR" or "CAD" or whatever. The amount of 
whitespace doesn't matter.

6. Save the file in the text editor and open it again in gnucash. (Feel free 
to re-enable "Compress File" again, if you like.)

I'm sorry for any inconvenience this might have caused.

Best Regards,

Christian


More information about the gnucash-devel mailing list