Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
1473 Vistas

Hello,


I'm having trouble importing CSV files into Odoo. I have two files: one with products and another with BOMs.


When I import the first CSV (products), everything seems to work fine. However, when I try to import the BOMs file, which references the product IDs from the first import, I get an error saying that the product IDs cannot be found.


Example:

products.csv
---------------
id,name,default_code,detailed_type,list_price,standard_price,uom_id/id,uom_po_id/id

product_1,Product 1,H1LP,service,0,0,uom.product_uom_unit,uom.product_uom_unit

product_2,Product 2,10380,service,11.03,11.03,uom.product_uom_unit,uom.product_uom_unit


bom.csv
---------------
id,product_tmpl_id/id,product_qty,type,bom_line_ids/product_id/id,bom_line_ids/product_qty

mrp_bom_f15_1_10,product_1,2,kit,,

mrp_bom_f15_1_10,,,,product_2,3


How can I correctly import BOMs along with their associated products so that the BOMs are imported together with the products?

Avatar
Descartar
Mejor respuesta

Export your data after importing it to verify the final External ID that Odoo has stored.

If you provide:

product_1

Odoo will set the External ID to:

__import__.product_1


This is because an External ID has the format:

string.string

Each string is made up of alphanumeric characters with no spaces and no period (since that is the separator)

Since you didn't supply the first part, Odoo had to.

Avatar
Descartar
Autor

Thank you for your answer. I tried adding the import statement, but after doing so, I encountered the following error:

Error at row 1: "Invalid external ID __import__.product_2: expected model 'product.product', found 'product.template'"

It looks like you have imported product.product records into Odoo as product.template records or vice versa.

It is important to understand the difference if you are going to be importing data into Odoo.

Search past forum posts for more information, such as:
https://www.odoo.com/forum/help-1/product-template-vs-product-product-94430

The best way to learn how to import things into Odoo is to EXPORT them first. Create a simple BoM and export it to see which External ID's Odoo uses and which are related to the Product (product.variant) and which are related to the Product Template (product.template).

Publicaciones relacionadas Respuestas Vistas Actividad
1
jun 23
1997
1
may 15
3634
0
mar 15
4093
1
mar 15
6821
2
mar 15
6754