Skip to Content
Menu
This question has been flagged
2 Replies
2463 Views

Lets say i have i am selling dual colored plates. The top can be black white or red, and the bottom side can be black white or red.

So i create a plate product with two variants, topcolor and bottomcolor and those attribute.

But when i make a quote and configure a product, in the quote line i get Plate (red, black) ... that is rather confusing as you dont have any context. And this is a simplified example, i have several boolean yes/no variants, so then you end up with (red, black, yes, yes, no).

Is there a way do list also the labels of the variants ? like Plate (topcolor: red, bottomcolor: black, giftwrapped: yes)

This is more clear for all parties.


Avatar
Discard
Best Answer

You must overwrite the _variant_name method in class ProductAttributevalue, examples like this:

class ProductAttributevalue(models.Model):
_inherit = "product.attribute.value"

  @api.multi
  def _variant_name(self, variable_attributes):
    return ", ".join(["%s: %s" % (v.attribute_id.name, v.name) for v in self if v.attribute_id in variable_attributes])

Avatar
Discard
Author Best Answer

Thank you Zbik for your answer.

I am still getting to know Odoo. Once i get the basic functionality i' ll start making modules/changes. And this will be my first i am sure.

Avatar
Discard