There's more...

Importing the one2many and many2many fields with CSV files is possible, but a bit tricky. In general, you're better off creating the records separately and setting up the relation with an XML file afterwards, or working with a second CSV file that sets up the relationship.

If you really need to create related records within the same file, order your columns so that all scalar fields are to the left and the fields of the linked model are to the right, with a column header consisting of the linking field's name and the linked model's field, separated by a colon:

"id","name","model_id:id","perm_read","perm_read", "group_id:name"
"access_library_book_user","ACL for books","model_library_book",1,
"my group"

This will create a group called my group; you can write more fields in the group record by adding columns to the right. If you need to link multiple records, repeat the line and change the right-hand side columns as appropriate. Given that Odoo fills empty columns with the previous line's value, you don't need to copy all the data—you can simply add a line with empty values saved for the fields of the linked model you want to fill.

For x2m fields, just list the XML IDs of the records to be linked.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset