Installing a new chart of accounts in OpenERP 4.2.3

I’ve been trying for some time to get a new chart of accounts for Peru into the OpenERP system, and I was frequently confronted to an ugly error saying:

(‘Error ! You can not create recursive accounts.’, ‘parent_id’)

The annoying thing being that it didn’t actually tell me which parent_id that was. Considering the size of an XML chart of accounts, it proved very difficult (if not impossible) to find the actual error, so I decided to drop the idea and continue integrating peruvian things into OpenERP on other aspects.

Today though, preparing a demo for a prospect here, I realised that the error was, in fact, detailed in the live logging of my OpenERP server. It was saying something like this:

Mon, 03 Nov 2008 13:22:57 INFO:init:
<record id=”chart32″ model=”account.account”>
<field name=”code”>322</field>
<field eval=”False” name=”reconcile”/>
<field name=”close_method”>none</field>
<field eval=”[(6, 0, [ref(‘chart32’)])]” name=”parent_id”/>
<field name=”type”>view</field>
<field name=”name”>Edificios y otras construcciones</field>

…which means that I had an element coded “322” which was using the same id as another element declared previously (chart32). Knowing this, I just had to fix the XML file (I also realized that I had two repeating entries around that one) and import it again into OpenERP and… tadaaaaa! I now have a running chart of accounts for Peru!

This, though, will only be helpful if you actually start the server by hand and have the logging appear in front of you. Damn, it feels so easy when it’s done.