[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 <yelizariev@users.noreply.github.com>
This commit is contained in:
Ivan Yelizariev
2020-11-17 14:44:59 +00:00
parent b0670da86b
commit fe38009e8f
+3 -1
View File
@@ -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