Hello all,
I am trying to import product data with XML-RPC in a Python Script. It works fine so far and all data will be imported exceptet Supplier Info.
I've read that this is a one2many field and i have to import it in an other way.
I want to import these Supplier Infos:
seller_ids/name/id
seller_ids/min_qty
seller_ids/delay
seller_ids/product_name
My code so far (Supplier Infos are in Comments because they don't work)
filepath = 'product_1.csv'
def reencode(file): for line in file: yield line.decode('windows-1250').encode('utf-8')
reader = csv.reader(reencode(open(filepath)),delimiter=';')
for row in reader: print row[5] product_template = { 'name': row[5], 'standard_price': row[8], 'list_price': row[6], 'description': row[11], 'mes_type':'fixed', 'uom_id':1, 'uom_po_id':1, 'type':'product', 'cost_method':'standard', 'procure_method':'make_to_order', 'categ_id':1} template_id=sock.execute(dbname, uid, pwd, 'product.template', 'create', product_template)
product_product = {
'product_tmpl_id':template_id,
'default_code':row[0],
##'seller_ids/name/id': row[1],
##'seller_ids/min_qty': row[2],
##'seller_ids/delay': row[3],
##'seller_ids/product_name': row[4],
'x_ek_netto': row[9],
'x_liefzeit': row[10],
'x_url': row[28],
'x_kolli': row[12],
'x_cbm': row[13],
'x_gewicht': row[14],
'x_wandmontage': row[15],
'x_versand': row[16],
'x_mbm': row[17],
'x_montage': row[18],
'x_montagekosten': row[19],
'x_vpe': row[20],
'x_serie': row[21],
'x_farbe': row[22],
'x_material': row[23],
'x_stil': row[24],
'x_masse': row[25],
'x_holzart': row[26],
'x_modell': row[27],
'x_logistikpartner': row[29],
'x_aufgebaut': row[30],
'active': True}
product_id = sock.execute(dbname,uid,pwd,'product.product','create', product_product)
Sorry can't format code write here. Hope you can read it :) CSV is fine. Import with OpenERP GUI works fine.
THANKS A LOT!