BUG? Account
under Invoices
keeps links to old accounts… when changing an invoice item to a non-inventory
item
Sorry for the ambiguous name, let me explain by way of example:
When attempting to delete a COA account type, I found I could not delete it because it was still referenced within manager, although it was not visible in any invoice I could find. It turns out it was referenced by an invoice where a line item had been later edited to become a non-inventory
item type where the associated COA had been changed (I did want to change the COA). However, the underlying COA Account
was still linked, even though it did not appear on the invoice.
#Demonstration:
##Setup
###Create some expense accounts in COA
###Create a non-inventory
item and associate it to a different COA:
###Here they are in the summary tab
##Start using it
###Create a purchase invoice
###Lock it in
###Check summary tab
###Go back and edit the invoice, make it a non-inventory
item
^^^ the above has a wrong price because it’s updated from the
non-inventory
item price. This is not relevant, I just made it a different price by mistake.
###So correct the price
###Check the summary tab again
^^^ The invoiced items appear in the correct account.
###clicking on the “nil cost” against AAAAAA (the little -
at the end) shows that no expenses exist
###Let’s try and delete the COA account
^^^ It shows us an invoice where AAAAAA is used, so let’s go and delete that line item
###Open it, but there is no AAAAAA
, only AABBBB
The reason I could not find this originally is my invoices have 20+ items in it and I’d forgotten I had changed an invoice item from a normal item to a non-inventory
item.
###Remove the non-inventory
item code and the old COA Account re-appears.
###Delete the Account
###Re-apply the non-inventory item type
###and update
##Summary
This is so much easier to find now because of the way @lubos has implemented a cross-check to find any remaining references. Back when I created these accounts, this reference finding tool didn’t exist.
I’m not sure if it’s a bug that the old account is linked behind the scenes. I can see a use case for it being there (like when you remove the item
type making it not a non-inventory
item anymore. It can revert to the old account. It’s possibly though that if yo made it a non-inventory
item then you would want it associated with that account and making it NOT a non-inventory
item anymore doesn’t necessarily mean you want to revert to the old account.
I would think that most people would not be changing accounts often, it’s just that back at the time I was refining where things should be for me, and so I did change it.
Anyway, that’s my story of how I cleaned out some old COA accounts I wanted to delete a long time ago.