Odoo Help


Importing Products with Supplier Info

Jan-Philipp Fischer
on 8/12/13, 7:54 AM 3,041 views

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:





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 = {
    ##'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.


martin mueller
On 9/21/13, 10:38 AM

Adding the supplier info would probably go like that (fields/values are certainly not correct for your example, but you will get the idea):

product_supplierinfo = {
    'name': 5,
    'product_code': row[0],
    'product_name': row[0],
    'min_qty': 2,
    'delay': 30,
    'product_id': template_id
product_supplierinfo_id = sock.execute(dbname, uid, pwd, 'product.supplierinfo', 'create', product_supplierinfo)

name is the id of your supplier NOT the name of the supplier (the field's name is misleading).

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

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 E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 8/12/13, 7:54 AM
Seen: 3041 times
Last updated: 3/16/15, 8:10 AM