import products by module and csv

Asked by Alberto Garcia (Factor Libre)

I try to import product with a module but I have errors with the csv.

I did 2 csv.

product.template

id,name,description,description_purchase,description_sale,type,supply_method,procure_method,categ_id,list_price,sale_ok,purchase_ok
producto_1,producto x,producto x,producto x,producto x,product,buy,make_to_order,1,10,True,True
producto_2,producto y,producto y,producto y,producto y,product,buy,make_to_order,1,20,True,True

product.product

id,code,product_tmpl_id:id
1,code x,producto_1
2,code y,producto_2

when I try install de module to import I have this error:

Traceback (most recent call last):
  File "/home/agl00014/proyectos/openerp/logiscenter/src/openerp-server-5.0.1-0/bin/netsvc.py", line 235, in dispatch
    result = LocalService(service_name)(method, *params)
  File "/home/agl00014/proyectos/openerp/logiscenter/src/openerp-server-5.0.1-0/bin/netsvc.py", line 74, in __call__
    return getattr(self, method)(*params)
  File "/home/agl00014/proyectos/openerp/logiscenter/src/openerp-server-5.0.1-0/bin/service/web_services.py", line 582, in execute
    return self._execute(db, uid, wiz_id, datas, action, context)
  File "/home/agl00014/proyectos/openerp/logiscenter/src/openerp-server-5.0.1-0/bin/service/web_services.py", line 562, in _execute
    return wiz.execute(db, uid, self.wiz_datas[wiz_id], action, context)
  File "/home/agl00014/proyectos/openerp/logiscenter/src/openerp-server-5.0.1-0/bin/wizard/__init__.py", line 178, in execute
    res = self.execute_cr(cr, uid, data, state, context)
  File "/home/agl00014/proyectos/openerp/logiscenter/src/openerp-server-5.0.1-0/bin/wizard/__init__.py", line 74, in execute_cr
    action_res = action(self, cr, uid, data, context)
  File "/home/agl00014/proyectos/openerp/logiscenter/src/openerp-server-5.0.1-0/bin/addons/base/module/wizard/wizard_module_upgrade.py", line 92, in _upgrade_module
    db, pool = pooler.restart_pool(cr.dbname, update_module=True)
  File "/home/agl00014/proyectos/openerp/logiscenter/src/openerp-server-5.0.1-0/bin/pooler.py", line 62, in restart_pool
    return get_db_and_pool(db_name, force_demo, status, update_module=update_module)
  File "/home/agl00014/proyectos/openerp/logiscenter/src/openerp-server-5.0.1-0/bin/pooler.py", line 40, in get_db_and_pool
    addons.load_modules(db, force_demo, status, update_module)
  File "/home/agl00014/proyectos/openerp/logiscenter/src/openerp-server-5.0.1-0/bin/addons/__init__.py", line 718, in load_modules
    r = load_module_graph(cr, graph, status, report=report)
  File "/home/agl00014/proyectos/openerp/logiscenter/src/openerp-server-5.0.1-0/bin/addons/__init__.py", line 611, in load_module_graph
    tools.convert_csv_import(cr, m, os.path.basename(filename), fp.read(), idref, mode=mode)
  File "/home/agl00014/proyectos/openerp/logiscenter/src/openerp-server-5.0.1-0/bin/tools/convert.py", line 853, in convert_csv_import
    pool.get(model).import_data(cr, uid, fields, datas,mode, module,noupdate,filename=fname_partial)
  File "/home/agl00014/proyectos/openerp/logiscenter/src/openerp-server-5.0.1-0/bin/osv/orm.py", line 641, in import_data
    process_liness(self, datas, [], fields_def)
  File "/home/agl00014/proyectos/openerp/logiscenter/src/openerp-server-5.0.1-0/bin/osv/orm.py", line 518, in process_liness
    id = ir_model_data_obj._get_id(cr, uid, module, xml_id)
  File "/home/agl00014/proyectos/openerp/logiscenter/src/openerp-server-5.0.1-0/bin/tools/misc.py", line 659, in cached_result
    result2 = fn(self2, cr, *args[:self.skiparg-2], **kwargs2)
  File "/home/agl00014/proyectos/openerp/logiscenter/src/openerp-server-5.0.1-0/bin/addons/base/ir/ir_model.py", line 420, in _get_id
    assert len(ids)==1, '%d reference(s) to %s.%s. You should have one and only one !' % (len(ids), module, xml_id)
AssertionError: 0 reference(s) to logiscenter_products1.producto_1. You should have one and only one !

Question information

Language:
English Edit question
Status:
Solved
For:
Odoo Addons (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Solved by:
Alberto Garcia (Factor Libre)
Solved:
Last query:
Last reply:
Revision history for this message
Alberto Garcia (Factor Libre) (agarcia-flibre) said :
#1

Topic solved by me

Revision history for this message
OscarAlca (oscarolar) said :
#2

Hi Alberto, I want to import products too, but I dont know how to setup the .csv file, do you know how to do it? or do you have the csv template? any help will be appreciated.

Revision history for this message
Alberto Garcia (Factor Libre) (agarcia-flibre) said :
#3

You can got to this link (is spanish) to get template csv to import:

http://www.aulaerp.com/cursos-aulaerp/ejemplos-de-ficheros-de-carga-csv.html

Revision history for this message
OscarAlca (oscarolar) said :
#4

thks man, that´s what I needed

Revision history for this message
Mahdi NOUKRATI (mahdink) said :
#5

hi Alberto,
i want to import product to using csv file, itry the open the link that you proposed to OscarAlca but it doesn't work, can you give me a new link?? thinks