I've just upgraded from 2.6.19 to 3.1, using Windows client and MySQL back end. Unposting and reposting an invoice or bill leaves additional records in the splits table, which causes the invoice to appear duplicated. Additionally the invoice then becomes corrupt and cannot be unposted again. I needed to edit the raw tables in SQL to remove the offending records and the invoice as well. Repeated the same steps twice on an invoice and a bill, with the same results. I can confirm this doesn't occur in 2.6.19
Thank you for your report. I have tried to reproduce this with the just released gnucash 3.2. Aside from one register refresh glitch I haven't been able to reproduce this. I can correctly unpost and repost invoices and bills. The always only appear once. The glitch was early on when experimenting with a newly created book in which I didn't have an A/P yet and that had to be saved to mysql starting from sqlite3. At some point one invoice transaction seemed to remain in the A/P account regardless of whether I unposted and reposted the invoice (upon reposting a second entry appeared). Closing the register and opening it again cleared the issue. I will note I didn't find a mysql db created during 2.6 that I could open in 3.2. Can you retry this on (a copy of) your book with 3.2 ? Or attach a db dump of a small mysql based book that shows the bad behaviour ? Thanks.
Ehr, "just released" is a tad premature. The 3.2 release is ongoing right now and should be there one of the next days. Please test when it's there or with a recent nightly build. Also I couldn't test on Windows, I can only say it works on linux.
Closing this as no further feedback has been provided. In case you still experience this with the current gnucash release please feel free to reopen this bug and provide a sample book in which you managed to replicate the behaviour.
Further note - in the context of bug 796836 I had rebuilt 3.1. And with that version I could reproduce this issue, using an sqlite3 based book. I started from an xml book with one credit note in it and saved this as sqlite. Then I had to restart gnucash before unposting and reposting the credit note to reproduce this issue. Without the restart I couldn't reproduce. I'm currently testing with the state of the gnucash sources as of today and I haven't been able to reproduce this again. I am reopening this bug though because we need code to fix the collateral damage: the user has no way of undoing the duplicate posting other than moving back to an old backup or directly manipulating the data file.
Created attachment 372958 [details] Sqlite based book containing an two post transactions for one credit note I'm adding this book illustrating the issue for future reference.
Created attachment 372959 [details] Sqlite based book containing a posted cn but missing post transaction The previous attachment was for a different bug... And while testing I found another mixup a use could end up due to the double posting issues on sql. This book has a credit note that can be edited, but the post button is disabled and the unpost button enabled. That should also never happen.
Created attachment 372960 [details] Sqlite based book containing an two post transactions for one credit note And this time the book with two post transactions for one invoice.
I have pushed the necessary fixes to get out of this situation. I have added some code to our check & repair function to detect double posted transactions. The Check & Repair is conservative it will not delete the double transaction, but it will alter is such that you can delete it if appropriate (after verifying your balance). A downside of Check & Repair is that it doesn't report which issues it has fixed directly to the user. But it does write messages to the current trace file. So if unsure of what you should still do as a user, open the gnucash trace file after running Check & Repair for additional information.
*** Bug 796836 has been marked as a duplicate of this bug. ***