Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
5437 Weergaven

I need to search and show product attribute values on Sales order lines.

EG: initially we have one product - shirt with 1 attributes with 4 values each.

So 

Product "Shirt"

Attribute 1 "Color" Values "Black","green","pink"and "orange"

That generates one product with 4 variants

I want to add custom columns to Sales order lines so that when i need to add a product in order line, At that time, i need to select the product -shirt in first column and in next column i need to search and select the variant names corresponding attributes are shown on Sales order line.

Avatar
Annuleer
Beste antwoord

Hello,

By odoo standard flow, all the product variant with respected attribute name will be shown in sale order lines.



And if you want to show the attribute value of product in order lines, then you need to take a new many2many field for product.attribute in order lines like

    product_template_attribute_value_ids = fields.Many2many('product.template.attribute.value', relation='product_variant_combination', string="Attribute Values", ondelete='restrict')

You need to set product.attribute value while onchange method of product in order lines model.

    @api.onchange('product_id')

    def product_id_change(self):

        super(class_name, self).product_id_change()

        if self.product_id.product_template_attribute_value_ids:

            self.product_template_attribute_value_ids = [(6, 0, self.product_id.product_template_attribute_value_ids.ids)]


Thanks.

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
2
mei 24
1114
0
okt. 24
773
1
dec. 22
1725
1
apr. 25
2192
1
jun. 24
2341