From fe38009e8f97dacb67d2daf7e191f4e1d1872801 Mon Sep 17 00:00:00 2001 From: Ivan Yelizariev Date: Tue, 17 Nov 2020 10:49:28 +0000 Subject: [PATCH] [FIX] sale: fix custom values order in product description STEPS: * activate Product Configurator * create 3 attributes with custom values option * create a quotation with a product having all 3 attributes and custom values * select the custom values for attributes in different orders for each SO line BEFORE: Product description get random order for the custom attributes list AFTER: Order is fine --- opw-2379778 closes odoo/odoo#61869 X-original-commit: 57eb05071a08251171dcfdb2308feb13c3281fa7 Signed-off-by: Ivan Yelizariev // IEL --- addons/sale/models/sale.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/sale/models/sale.py b/addons/sale/models/sale.py index 6cd702e7f27..6fbaa06ea18 100644 --- a/addons/sale/models/sale.py +++ b/addons/sale/models/sale.py @@ -1877,8 +1877,10 @@ class SaleOrderLine(models.Model): for ptav in (no_variant_ptavs - custom_ptavs): name += "\n" + ptav.with_context(lang=self.order_id.partner_id.lang).display_name + # Sort the values according to _order settings, because it doesn't work for virtual records in onchange + custom_values = sorted(self.product_custom_attribute_value_ids, key=lambda r: (r.custom_product_template_attribute_value_id.id, r.id)) # display the is_custom values - for pacv in self.product_custom_attribute_value_ids: + for pacv in custom_values: name += "\n" + pacv.with_context(lang=self.order_id.partner_id.lang).display_name return name