import_data for accounts

17 views
Skip to first unread message

Richard PALO

unread,
Jul 16, 2017, 6:20:40 AM7/16/17
to tryton
Continuing my adventure with openerp2tryton, I come across a new challenge.

Part of the migration includes adapting the default accounting plan with a csv file.
PM: I am using account_fr for the French PCG.

I use the following header:
>id,name,active,code,kind,parent,party_required,reconcile,deferral,type

everything seems okay until I get to the VAT accounts (4452xx and 44566x,
where "Autres" is not a unique name in account.account.type.template (nor in account.account.type)
and thus gives an error.

There doesn't seem to be any Parent parsing, so prepending a parent
(eg 'Créances d'exploitation\Autres') doesn't seem to work nor does replacing
the the 'name' with the id directly (tag nor value)...

Looking at the code for import_data() in modelstorage.py I thought I'd try
using 'type:id' in the header and 'account_fr.creances_autres' in the value
but then I get the following:
> psycopg2.IntegrityError: ERREUR: une instruction insert ou update sur la table « account_account » viole la contrainte de clé
> étrangère « account_account_type_fkey »
> DETAIL: La clé (type)=(196) n'est pas présente dans la table « account_account_type ».

it appears that import_data uses account.account.type and not account.account.type.template where the db_id retrieved is
indeed the id of the type but which appears not to be maintained in account.account.type.

Is this a bug in account.account.type structure (that is, losing the valid ids)?

Other ideas on how to import these VAT accounts?
--

Richard PALO

Cédric Krier

unread,
Jul 16, 2017, 7:40:06 AM7/16/17
to tryton
It is not a bug, it is how the account module is designed (look at the
target of the type Many2One).

> Other ideas on how to import these VAT accounts?

The CSV importation is a very fragile methods, it is used on
openerp2tryton to manage simple case. For more complex case, you should
write a module to complete (or create) the chart of account template.

--
Cédric Krier - B2CK SPRL
Email/Jabber: cedric...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/
Reply all
Reply to author
Forward
0 new messages