For an Odoo.sh v17 implementation.
I have loaded the products (footwear) and created the sizes attribute.
I can identify the IDs of `product.product` or `product.template` using:
product_ids = lnk_dbcom.execute(
'product.product',
'search_read',
[[('default_code', 'in', codes)]], # codes = list of product's code
{'fields': ['id', 'product_tmpl_id']})
I can also locate the IDs for the attribute and for the different variants:
product_attribute_ids = lnk_dbcom.execute(
'product.attribute.value',
'search_read',
[[('name', 'in', sizes)]],
{'fields': ['id', 'attribute_id']}
)
Which model should the variants be linked to? product.product or product.template
How can I assign the selected size variants to each of the products (or templates) using XML/RPC?
I've tried several ways but I can't get it to work
# -
operation = [(1, attribute_line_id, {'value_ids': [(6, 0, product_attribute_ids)]})]
lnk_dbcom.execute(
'product.template',
'write',
[product_template_id]],
{'attribute_line_ids': operation})
*note: **lnk_dbcom** es un objeto que encapsula la conexion a odoo usando xml/rpc*