diff options
| author | Ivan Yelizariev <iel@odoo.com> | 2020-11-17 10:49:28 +0000 |
|---|---|---|
| committer | Ivan Yelizariev <iel@odoo.com> | 2020-11-17 14:17:19 +0000 |
| commit | bb2fae9cc2acf0ff1d8297f09c34cbb3cd67c0be (patch) | |
| tree | a6d138ad8f6f00bab64351e2fd146fec28c92fda | |
| parent | a0e012f1578b6257816dfb1a508781d054b95198 (diff) | |
[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#61862
X-original-commit: 57eb05071a08251171dcfdb2308feb13c3281fa7
Signed-off-by: Ivan Yelizariev // IEL <yelizariev@users.noreply.github.com>
| -rw-r--r-- | addons/sale/models/sale.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/addons/sale/models/sale.py b/addons/sale/models/sale.py index 7ad5f982e85..5e69b1e11b7 100644 --- a/addons/sale/models/sale.py +++ b/addons/sale/models/sale.py @@ -1870,8 +1870,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 |
