odoo/odoo#258458

Created by fw-bot
Merged at 6b7406fcab84581990cdf67a877477f8a0c9b549

Statuses:

label
odoo-dev:18.0-17.0-opw-5955875-account_product_name_translation-esand-509483-fw
head
6af745b671ebfe9fdbcf2762f041cc23f0409755
merged
1 day ago by Ester Andreetto (esand)
odoo/odoo
17.0 #254833
18.0 #258458
saas-18.2 #258615 missing r+
saas-18.3 #258660 missing r+
saas-18.4 #258707 missing r+
19.0 #258737 missing r+
saas-19.1 #258768 missing r+
saas-19.2 #258789 missing r+
master #258801 missing r+

[FIX] account: display product name in correct language in an invoice

Issue before this commit:

When creating an invoice using the child contact of a parent contact that has a different language with respect to the father, the label of the invoice line was not always displayed in the child contact language but in the father's contact language.

Steps to reproduce the issue:

  1. Activate at least 2 languages (X and Y)
  2. Create a product and set the translation for that product in the activated languages
  3. Create a Contact with the language X
  4. Create a child contact (invoice adress type) for that contact with language Y
  5. Create a new invoice setting the customer as the child contact
  6. Add the product you created
  7. See the label is displayed in the language of the parent contact

Cause of the issue:

The computation of the invoice line name relied on line.partner_id.lang. However, the partner_id of the move line is automatically set to the commercial partner that can be different (can be the father's contact) to the contact used on the invoice. As a result, the product description was translated using the wrong language.

Reason to introduce the fix:

To ensure that invoice line labels are correctly translated according to the language of the selected invoice contact, the computation now uses the language of move_id.partner_id instead of line.partner_id. This guarantees consistent and expected behavior in multilingual environments, especially when using different contacts under the same commercial partner.

opw-5955875


I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

Forward-Port-Of: #254833