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 :
ean13_code.jpg
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 :
#!/bin/bash
# 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 :
csv.field_size_limit(2097152)
delete the file addons/base_import/models.pyc
- restart your server
- redo the import of your out.csv file
Can you please share your file with 2/3 records.