Skip to Content
Menu
This question has been flagged
1 Reply
1504 Views

I tried to get a specific product variant by TemplateID and attributeValueID with the follow codes:
attributeValueIds = models.execute_kw(db, uid, password, 'product.template.attribute.value', 'search', [[['product_tmpl_id', '=', product_template_id], ['product_attribute_value_id', '=', attribute_id]]], {'limit':1})
if len(attributeValueIds) >0:
 attributeValueId
= attributeValueIds[0]

...
set1 = models.execute_kw(db, uid, password, 'product.variant.combination', 'search_read', [[['product_template_attribute_value_id', '=', attributeValueId]]], {'field': ['product_product_id']})

And I got an error:
xmlrpc.client.Fault: product.variant.combination doesn't exist">


Is there anyone can help? Appreciate. 

Avatar
Discard
Author Best Answer

Just found that, the table "product_variant_combination" is a relational table for product.product and product.template.attribute.value. So no model named "product.variant.combination" at all.

Can I query the product varirants like this?
models.execute_kw(db, uid, password, 'product.product', 'search_read', [[['product_template_attribute_value_ids', 'in', [attributeValueId]]]])

Avatar
Discard