[FIX] sale: correct translation of sale description in shopping cart
Current behaviour: In the eCommerce, if you add a product that has a sale description (properly translated) in a website that is set in another language than the default for the company, the description of the product in the shopping cart was the default for the company, not the one set on the website. Expected behaviour: Product description language should follow the website's language, in both the eCommerce, and in the shopping cart. Steps to reproduce: - Install eCommerce - Add a second language of choice and add it to the website - On a product add a sale's description in both languages - Logout, go on the e-shop on your product, switch the website to language 2 - Observe that the language of the description is indeed language 2 - Add it to cart, go in the cart. - Observe that the language of the description is language 1, not 2. Reason for the problem: Since the cart is a `sales.order`, and each item in it is a `sale.order.line`, we use the language of the partner for the description. But by default the language of the public user is the same as the company, not the one from the current context, which would be the one from the website. Fix: We don't take the language of the partner, if that partner is the `public user`. Affected versions: - saas-15.2 - 16.0 - saas-16.1 - master opw-3142666 closes odoo/odoo#112738 X-original-commit: 2b0c52e08c35607c9ad75b491978231037a1340c Signed-off-by: William Braeckman (wbr) <wbr@odoo.com> Signed-off-by: Piryns Victor (pivi) <pivi@odoo.com>
This commit is contained in:
@@ -299,8 +299,9 @@ class SaleOrderLine(models.Model):
|
||||
for line in self:
|
||||
if not line.product_id:
|
||||
continue
|
||||
|
||||
name = line.with_context(lang=line.order_partner_id.lang)._get_sale_order_line_multiline_description_sale()
|
||||
if not line.order_partner_id.is_public:
|
||||
line = line.with_context(lang=line.order_partner_id.lang)
|
||||
name = line._get_sale_order_line_multiline_description_sale()
|
||||
if line.is_downpayment and not line.display_type:
|
||||
context = {'lang': line.order_partner_id.lang}
|
||||
dp_state = line._get_downpayment_state()
|
||||
|
||||
Reference in New Issue
Block a user