On 12/01/10 18:43 +0100, Hartmut Goebel wrote: > Hi, > > in <https://bugs.tryton.org/roundup/issue1368> Cedk wrote: > > > But the export doesn't work for import. > > The format is different especially with the relational fields. > > So my questions are: > * How do I export hierarchical categories from a database?
Like you already do.
> * How do I import hierarchical categories into a database?
This is linked to categories (issue1369 [1]) because the rec_name of
categories can not be used to search on it. So without the fix, you should use
only the name of the category to import it. The csv header will look:
name,parent
Cat,
Child1,Cat
Child2,Child1
this will produce:
Cat
|- Child1
|- Child2
This will work if you have unique name of categories.
>
> I would have expected to be able to import the categories I just exported.
>
It works but it should follow some rules for the relational fields.
- For selection, you must set the internal value (It could be improved to use
the translated value if internal doesn't match)
- For many2one, you must set the value of rec_name, Tryton will use the first
found record that have the same rec_name.
- For many2many, it works like many2one except that it allow many values
separated by comma.
- For one2many, see http://code.google.com/p/tryton/wiki/ImportData
In conclusion, the import/export was not design to import the exported data.
It was design to export data for external purpose and to import data from
external sources.
[1] http://bugs.tryton.org/roundup/issue1369
--
Cédric Krier
B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59
Email: [email protected]
Jabber: [email protected]
Website: http://www.b2ck.com/
twitter: http://twitter.com/cedrickrier
identi.ca: http://identi.ca/cedrickrier
pgpVBw4Vhz5A6.pgp
Description: PGP signature
