Odoo 11 variants of a product by CSV: it does not assign all the internal reference by column default_code

-1

I am trying to import 9000 products that have size and color attributes. There is an average of 28 product variants for each, adding about 9000.

When Odoo receives an import like this:

name id default_code roduct_variant_ids / attribute_value_ids Dextrógiro-levógiro 20313931 20313931_multicolor-unica multicolor, unica
Dextrógiro-levógiro n-m 20313931 1001032900_negro-m black, m Right-lewd to-l 20313931 1001032900_azul-l white, m

Originates three variants, but only the first puts internal reference. It is only possible to search by name and barcode, but not all variants are assigned the internal reference by the default_code column, as can be seen in the photo .. does anyone know why the uploaded variants are only identified by barcode and name exclusively?

    
asked by juanato.SPAIN 05.10.2018 в 07:46
source

1 answer

0

I guess the file you're using to import is separated by tabs but, since they do not distinguish well on a web page, I took the liberty to rewrite it in a comma separated format:

name,id,default_code,product_variant_ids/attribute_value_ids
Dextrógiro-levógiro,20313931,20313931_multicolor-unica,"multicolor,unica"
Dextrógiro-levógiro n-m,20313931,1001032900_negro-m,"negro,m"
Dextrógiro-levógiro a-l,20313931,1001032900_azul-l,"blanco,m"

If the rewrite went well, I see that the column id contains the same value in the three lines and that is a problem because the header id tells Odoo that the column contains xmlids and these must to be unique.

As the file is, when reading the first line Odoo interprets that its xmlid is tu_modulo.20313931 and, if there is no record with that external identifier, it creates it by means of a SQL INSERT command; then, read the second line and re-interpret that its xmlid is tu_modulo.20313931 and therefore it already exists, so instead of inserting a new line what it does is update with a SQL UPDATE command the previous line.

[Edited to add the following]

name,id,default_code,product_variant_ids/attribute_value_ids
Dextrógiro-levógiro,product_20313931_multicolor_unica,20313931_multicolor-unica,"multicolor,unica"
Dextrógiro-levógiro n-m,product_20313931_negro_m,1001032900_negro-m,"negro,m"
Dextrógiro-levógiro a-l,product_20313931_azul_l,1001032900_azul-l,"blanco,m"
    
answered by 06.10.2018 в 08:02