[FIX] sale: context lang used on product variants display name

Steps to reproduce:
- install sales and contact
- install another language
- go to contacts, pick a specific contact and set its language to
the new language installed
- go to sales > settings > activate the "product configurator" option
- create a product with a translated variant (the variant has to have
at least 2 translated attributes with custom values)
- create a quotation with the modified contact and the product
with the variant (use the product configurator wizard) > save
- print that quotation

Previous behavior:
product description is not fully translated
the part describing the variants is in the current user's language
while the product display_name is using the associated partner's
language

Current behavior:
product description is fully translated into the correct language

opw-2168102

closes odoo/odoo#44144

X-original-commit: 4a542cbd3655b7058ff4dd22feaeb18c6d3ec510
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
jerome hanke (jhk)
2020-01-28 17:30:25 +00:00
parent f167c3d072
commit 2ecbfddd6b
+2 -2
View File
@@ -1675,10 +1675,10 @@ class SaleOrderLine(models.Model):
# display the no_variant attributes, except those that are also
# displayed by a custom (avoid duplicate description)
for ptav in (no_variant_ptavs - custom_ptavs):
name += "\n" + ptav.display_name
name += "\n" + ptav.with_context(lang=self.order_id.partner_id.lang).display_name
# display the is_custom values
for pacv in self.product_custom_attribute_value_ids:
name += "\n" + pacv.display_name
name += "\n" + pacv.with_context(lang=self.order_id.partner_id.lang).display_name
return name