[FIX] sale: use partner's lang on creating invoices
This commit adds lang context on preparing invoice lines. Othwerwise we may get lines in user's lang instead of partner lang. For example, it's needed in sale_subscription module: https://github.com/odoo/enterprise/blob/e5e168d596aaefcd842fc553890e474aff3322f2/sale_subscription/models/sale_order_line.py#L235-L236 https://github.com/odoo/enterprise/blob/e5e168d596aaefcd842fc553890e474aff3322f2/sale_subscription/models/sale_order_line.py#L262 STEPS: - Use English as your user language - Set a language different from English on a customer C - Create a subscription product P - Create a SO for C with P - Create the invoice opw-3104785 closes odoo/odoo#110152 X-original-commit: 6dee103df5e5f64d8edf871d4e1a284ef4d21725 Signed-off-by: Ivan Elizaryev (iel) <iel@odoo.com>
This commit is contained in:
@@ -1078,7 +1078,7 @@ class SaleOrder(models.Model):
|
||||
invoice_vals_list = []
|
||||
invoice_item_sequence = 0 # Incremental sequencing to keep the lines order on the invoice.
|
||||
for order in self:
|
||||
order = order.with_company(order.company_id)
|
||||
order = order.with_company(order.company_id).with_context(lang=order.partner_invoice_id.lang)
|
||||
|
||||
invoice_vals = order._prepare_invoice()
|
||||
invoiceable_lines = order._get_invoiceable_lines(final)
|
||||
|
||||
Reference in New Issue
Block a user