How it works...

You simply drop all your data files in your manifest's data list. Odoo will use the file extension to decide which type of file it is. A specialty of CSV files is that their file name must match the name of the model to be imported, in our case, ir.model.access. The first line needs to be a header with column names that match the model's field names exactly.

For scalar values, you can use a quoted (if necessary, because the string contains quotes or commas itself) or an unquoted string.

When writing many2one fields with a CSV file, Odoo first tries to interpret the column value as XML ID. If there's no dot, Odoo adds the current module name as a namespace, and looks up the result in ir.model.data. If this fails, the model's name_search function is called with the column's value as a parameter, and the first result returned wins. If this also fails, the line is considered invalid and Odoo raises an error.

Note that data read from CSV files is always noupdate=False, and there's no convenient way around this. This means that subsequent updates of your add-on will always overwrite possible changes made by the user.
If you need to load huge amounts of data and noupdate is a problem for you, load a CSV file from an init hook.
..................Content has been hidden....................

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