Re: [tryton] import_data for accounts

2017-07-16 Thread Cédric Krier
On 2017-07-16 12:20, Richard PALO wrote:
> 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)?

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.kr...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

-- 
You received this message because you are subscribed to the Google Groups 
"tryton" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton/20170716113514.GW30717%40kei.


[tryton] import_data for accounts

2017-07-16 Thread Richard PALO

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

--
You received this message because you are subscribed to the Google Groups 
"tryton" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton/2454336e-8553-0a0e-0dda-a1a680e083f5%40free.fr.