Hello,
I am trying to send a csv document from my computer to the Odoo database with a python script. I find a script on internet and I am trying to make it works for my case.
But I have the [Errno -2] and I searched for answers but I couldn't be able to not make this mistake. If someone can help me :
import csv
import xmlrpclib
from socket import gaierror
username="aliciaboullery@yahoo.fr"
pwd = "mdp"
dbname = "bitnami_odoo"
sock_common = xmlrpclib.ServerProxy("http://localhost:8080/xmlrpc/common")
uid = sock_common.login(dbname, username, pwd)
sock = xmlrpclib.ServerProxy("http://localhost;8080/xmlrpc/object")
reader =csv.reader(open('fichier.csv', 'rb'))
for row in reader:
print row[1]
product_template = {
'name':row[1],
'standard_price':row[2],
'list_price':row[2],
'mes_type':'fixed',
'uom_id':1,
'uom_po_id':1,
'type':'product',
'procure_method':'make_to_tock',
'cost_method':'standard',
'categ_id':1}
template_id=sock.execute(dbname,uid,pwd, 'product.template', 'create', product_template)
product_product = {
'product_tmp1_id':template_id,
'default_code':row[0],
'active': True,
}
product_id = sock.execute(dbname, pwd, 'product.product', 'create', product_product)
Thank you for your help!
sock = xmlrpclib.ServerProxy("http://localhost;8080/xmlrpc/object")
You're using semicolon after localhost in Url, Change it to
sock = xmlrpclib.ServerProxy("http://localhost:8080/xmlrpc/object")