Odoo Help


12 Answers

Marc Cassuto

--Marc Cassuto--
Arche TI
| 4 5 10
Montreal, Canada
--Marc Cassuto--

Marc Cassuto
8/2/13, 5:43 PM

Here the complete procedure for Linux users :

1/ import all your products

2/ export your products : this step is mandatory to get the external ID of your product. In my case I exported Name (that is mandatory) and ean13 since the picture's filename was name as follow :


3/ open your exported file (product.product.csv) with libreoffice and save it again with option "edit filter settings" in order to change the CSV separator to whatever else than ",". This is a little trick to avoid complicated script to deal with record that embed a coma.

4/ use the following script :

    # Usage : MakeBase64CSV.sh infile.csv outfile.csv
    # infile.csv columns are : externalID, name, filename or identifier
    # infile.csv separator MUST BE |

echo \"External ID\",\"Name\",\"image\" > $2

while IFS="|" read f1 f2 f3; do

    # recopy external ID and name
    echo -n $f1,\"$f2\", >> $2

    #If third column represents the picture's filename (not the key), please use this command
    #cat $(echo ${f3} | tr -d '\r' | tr -d '"') | base64 --wrap=0 >> $2

    #If third column represents the key to match with the filename, please use this command
    cat $(echo ${f3} | tr -d '\r' | tr -d '"').jpg | base64 --wrap=0 >> $2

    #Carrier return at end of line
    echo  >> $2
done < $1

5/ then use your script

./MakeBase64CSV.sh product.product.csv out.csv

In my example, all the pictures are in the same directory.

6/ you can now import your file out.csv into openERP. (Don't forget to change the CSV separator).

7/ If you run into the following error :

field larger than field limit (131072)

Please do the following :

  • modify the file addons/base_import/models.py
  • add the following line at the very begining of the _convert_import_data function :


  • delete the file addons/base_import/models.pyc

  • restart your server
  • redo the import of your out.csv file
1 Comment
6/2/14, 7:15 PM

hi Marc, would you mind to correct the line that has been identified as faulty (if the complaint is correct)?

Bart Criel
2/13/14, 10:07 AM

I encountered a few problems when using Marc's steps, but I sorted it out.

  1. The one but last line in the bash script needs to be echo \" >> $2, and not echo >> $2
  2. I ran into the field limit, mentioned in step 7. Adding the line csv.field_size_limit(2097152) did not help. Instead, I added the line at the very top of the function _read_csv in models.py

After making these changes, I was able to generate an import file, and to import pictures to my products.


1 Comment
Nicolás Visús
8/22/14, 12:05 AM

Hi Bart, you solved it? I did the script but when i try to import "out.cvs" on "odoo import page", the system doesn't recognice the file. Would you explain me how you did? At least until you gave the error... Thanks

Cyrus Waithaka
4/4/16, 7:08 PM

I have uploaded a module on odoo apps that can help achieve this need.  https://apps.odoo.com/apps/modules/9.0/product_image_from_url/ 

My module employs the concept of importing the images as URLs using a normal csv/ excel import file. You can then download the images from the imported URLs in batch. I hope this will help.

Nicolás Visús
8/22/14, 12:03 AM

Is need to put the line csv.field_size_limit(2097152) (or a bigger number. Depends of image size) in lines 230 and 271, next to "_read_csv" and "convert_import_data" lines into addons/base_import/models.py file.

Then follow the instructions above.


AD LIBITOM, michel Guénard
8/22/14, 3:25 AM

Your file should have the extension csv NOT cvs!

Nicolás Visús
8/22/14, 12:56 PM

Yes. Mi file ("out.csv") have a CSV extension. My mistake was in having skipped the step of modifying "csv.field_size_limit (2097152)". Now it works! Thanks for your answer

Nicolás Visús
9/3/14, 1:19 AM

Is need to put the line csv.field_size_limit(2097152) (or a bigger number) in lines 230 and 271, next to "_read_csv" and "convert_import_data" lines into addons/base_import/models.py file.

Then follow the instructions above.

Thomas Walter
5/26/14, 6:04 PM

Dear all,

thanks for this post. I managed to create an upload file for my pictures.

Unfortunately i run into the "field larger than field limit" error. I tried to add the "csv.field_size_limit(2097152)" into the model.py file, deleted the models.pyc file and restarted the server.

However no matter where i put the csv.field_size_limit statement the openerp either does not work or shows the same failure.

Could you please post specify more precisly where i have to put the csv.field_size_limit?

thanks, Thomas

Ask a Question
Keep Informed
7 follower(s)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Odoo Training Center

Access to our eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now