Bug in lots ?

Geert Janssens janssens-geert at telenet.be
Sat Oct 13 13:13:12 EDT 2007

Working with Gnucash 2.2.1 on Mandriva 2007.1 Spring. BTW, I used the Mandriva 
2008.0 src rpms for Gnucash to get this version on 2007.1.

I have been using Gnucash in a particular way lately:
Using the business utilities, I create customer's invoices, for which I enter 
payment information before they actually get posted, for example a customer 
making an advance payment (before actually having made the final invoice). 
This seems to mess up the lots that are behind it, at least in my book. Note 
that the book I first encountered this issue in, was originally created with 
GnuCash 1.8.x and I have worked on it in Gnucash 2.0.1 as well.

I'll work with an example, to show how I can reproduce this:
Note: I have the lot viewer open on Accounts receivable (where all lots for my 
customer's invoices show up)

1. I create a new invoice (test1) for customer test, for 100 €
2. Without posting the invoice, I make a payment (real world example: a 
customer makes an advance payment)

=> The lot viewer will get a line like this:

This suggests a new lot has been created, but apparently when the invoice is 
not posted, the invoice doesn't get associated with this lot. I'm not sure 
if/how Gnucash knows which invoice this lot belongs to.

3. I create a second invoice (test2) for customer test, this time for 50€
4. Again, I pay it without posting it.

=> The lot viewer will show now:

The line in the lot now has the net worth of the two invoice payments as 

5. I now post the first invoice (test1)

=> The lot viewer will show:

A lot from the previous step now explicitly gets linked to test1, and the 
balance is set to 0. Also a new lot suddenly appears which has got only an 
imbalance of 29 instead of 50. Strange.

6. I now proceed to post the second invoice (test2)

=> The lot viewer will show:

So the 29 € imbalanced lot now gets explicitly associates with invoice test2 
and has a new imbalance of 31,5€. I don't understand this. When I open the 
Pay Invoice dialog for this second invoice, this also tells me 31,5€ is still 
to pay.

7. The payments for both invoices were made to the Cash account. I open this 
account, and remove the two payments.

=> The lot viewer will show:

Invoice test1 now has an imbalance of 150€, while the imbalance for test2 
hasn't changed. Trying to pay invoice test1 will ask me to pay 150€, although 
the invoice is actually only 100€

Clearly the two payments while the invoices weren't posted both got associated 
with the first invoice.

I first thought this was a problem with my book.
But when I perform the exact same steps in a new book, the steps up until 6 
will work correctly. Step 7 also will cause both the removed payments to 
change the imbalance on test1. So in a new book, after step 7 to pay invoice 
test1 again, it will require 150€ in the payment dialog and 0€ for invoice 
test2. This is not correct, because invoice test1 only values 100€ and 
invoice test2 values 50€.

I think the problem starts with the payments on unposted invoices getting 
linked in one and the same lot, although the actions a user (me in this case) 
takes in the business accounting screens suggest separate lots should be 
used. In my opinion, a payment made explicitly for one invoice should never 
be linked to the lot of another invoice.

Do other people have this problem also ?

Also, I am stuck with an inconsistent datafile now. Any hints on how I can 
clean it up ? Where did the 29 and 31,5 come from in my book ?


Geert Janssens

More information about the gnucash-devel mailing list