Skip to Content
Menu
This question has been flagged
2886 Views

Hi all,

I'm trying to export some products from another platform to Odoo. As far I've understood to create the different variants I should create the product template first and then create several product attribute lines, one for each different attribute. 

I have no issues creating the template, but I'm stuck when it comes to the product attribute lines. Following this forum reply (https://www.odoo.com/es_ES/forum/ayuda-1/question/how-to-create-product-product-variant-using-rpc-101043) I'm currently doing this:

product_line = models.execute_kw(odoo_db, uid, password, 'product.attribute.line', 'create', {    template_id: template_id,    attribute_id: attr.first,    value_ids: [6, 0, [attr.last]]})

Where template_id is, of course, the Odoo template id, attr.first is the ID of the attribute type (size, color, etc - 1 for size in this case) and [attr.last] is an array with the ID of the attribute value ([4]). 

Nevertheless, I'm getting this error when executing the line:

ValueError: dictionary update sequence element #0 has length 1; 2 is required

I have no clue why - I may be using the value_ids format wrong but I can't find what's wrong. 

Any help would be appreciated :)    I'm using Odoo 10.

Avatar
Discard