GNOME Bugzilla – Bug 357696
Billable items appear in more than one invoice
Last modified: 2018-06-29 21:13:09 UTC
Please describe the problem: I have billable items showing up in more than one customer invoice. Steps to reproduce: 1. Create a vendor and customer. 2. Create "invoice #1" for the customer. 3. Create "bill #1" for the Vendor charged back to the customer. 4. Post the Vendor "bill #1". 5. The billable items show up in the Customer "invoice #1". 6. click on the "invoiced?" column which puts an x in it. 7. Select an "Income Account" for the billable item. 8. Post "invoice #1" 9. Create customer "invoice #2" 10. The items from "bill #1" reappear in "invoice #2" Actual results: The billable items that are billed in the posted invoice show up again in a newly created invoice. Expected results: Itemes that are billed in a posted invoice should not appear in another invoice. Does this happen every time? I would say frequently enough that I've stopped using gnucash in my business for the moment. Other information: I brought up the problem to the GnuCash user mailing list in this thread http://article.gmane.org/gmane.comp.gnome.apps.gnucash.user/18243
Created attachment 73400 [details] account file with bilable items occurring in more than one invoice
I have the same problem with items coming from Employee Voucher e.g. when I have expenses I want to charge back to my customer. Every time I create new invoice for this customer I see the list of those items from an old (posted) invoice. They are editable and the changes propagate to the old invoice. When I post the new invoice the old items disappear. This happens every time. I use GnuCash 2.2.1
The logic is supposed to be: /* Match: (where I-TYPE == Invoice or Bill) * * 1. book AND * 2. ( Entry->I-TYPE == ledger->invoice * #if I-TYPE == Invoice (entry only) * OR * 3. ( Entry->Invoice == NULL AND * ( Entry->Billable == TRUE AND * Entry->Bill->Is-Posted? == TRUE AND * ( Entry->BillTo == Invoice->parent OR * Entry->Bill->BillTo == Invoice->parent ) ) * OR * ( Entry->Order->real-parent == Invoice->parent ) ) * #endif * ) * * Note that term 3 is only for Editable invoices. */ Is this logic wrong?
I'll note that I CAN reproduce this in trunk using the supplied data file. At first I thought the problem might've been in the qof query core due to a change where sometimes (now) a GUID isn't NULL, but is guid_null(). But changing the test there didn't fix the bug so there's something else going on here.
FYI, This bug appears to be present in 2.2.6 (Ubuntu) as well. I too have a series of previously invoiced billable items which show up when entering a new invoice, but disappear when posted...
I managed to track this one down. The logic mentioned in comment#3 is not exactly how the query is implemented. The implementation is slightly stricter even (which is correct as far as I can see). The issue arises from an logic error deep inside the query builder code. Due to that bug, the "test for a NULL guid" condition is effectively never added correctly, which results in a different query that returns entries when it should not. Anyway, I have fixed this in r19132. The first release that will have this fix will be 2.3.13.
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=357696. Please update any external references or bookmarks.