This question has been flagged
3 Replies
2754 Views

What string, utf-8 or otherwise, should I use that translates to a linebreak (\n, 0x0a) when importing a CSV file into Odoo?

We have some Memo fields that have lots of newlines. The text imports into Odoo as one single paragraph. I would like to have the newlines show as, well, newlines.


Avatar
Discard
Best Answer

This note is based on Odoo 14

Specifically for a text field, an import such as the following

val1,"val2
more val2a", val3

is imported correctly with the second field correctly input with val2 on one line and 'more val2a' on the next line when the record is viewed.

I used the default settings in a text editor such as Sublime to save the file. For the example above, the entry in the Sublime text editor (on the screen) appears exactly as shown above.

Note that this behavior is not seen if the field is a Char field. In that case, the value woud appear like 'val2 more val2a' where the newline character is replaced with the space character by the import. It does work though if the import is in a Text field

Note also that the Preview does display the newline as a space though the final import will retain the newline.

Avatar
Discard
Author Best Answer

I am not clear how "Python-PostgreSQL Database Adapter" helps with importing a CSV file into Odoo.

Avatar
Discard
Best Answer

I know that psycopg2 handles \n well, which if you have anymore than a couple of thousand rows is what you want to use, unless you love weekend/ week long runs. 

Avatar
Discard