Hey, I've got an error, when I create a product variant dynamicly and add it to the cart with python code in an automation action.
This is the error:
Der Vorgang kann nicht ausgeführt werden: duplicate key value violates unique constraint "product_product_combination_unique" DETAIL: Key (product_tmpl_id, combination_indices)=(2208, ) already exists.
This is how I create th variant:
used_variant = env['product.product'].create({
'product_tmpl_id':paddle.id,
'product_template_variant_value_ids':[(6,0,translated_values)]
})
this is how I add it to the order.line
order_line = env['sale.order.line'].create({
'order_id': order.id,'product_id': used_variant.id,'product_uom_qty': 1,'price_unit': used_variant.lst_price,
})