From fc659d3f78cb3c42e742ad9fa47a3df8d2d72b9b Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Mon, 8 Jan 2018 15:48:52 +0100 Subject: [PATCH] [FIX] sale: Description of the product 'Downpayment' not translated When you create a down payment invoice from an SO, the product that is used in the line is 'Down Payment'. The description of this product, which is visible for the customer, was not translated to the language of the customer in the SO and in the invoice. It was translated to the language of the user logged. This fix is made to keep the same behavior for the description of an SO line and for the description of the invoice line. opw:1820081 --- addons/sale/wizard/sale_make_invoice_advance.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/sale/wizard/sale_make_invoice_advance.py b/addons/sale/wizard/sale_make_invoice_advance.py index 7f27ccf4570..eca97519e48 100644 --- a/addons/sale/wizard/sale_make_invoice_advance.py +++ b/addons/sale/wizard/sale_make_invoice_advance.py @@ -76,12 +76,14 @@ class SaleAdvancePaymentInv(models.TransientModel): if self.amount <= 0.00: raise UserError(_('The value of the down payment amount must be positive.')) + context = {'lang': order.partner_id.lang} if self.advance_payment_method == 'percentage': amount = order.amount_untaxed * self.amount / 100 name = _("Down payment of %s%%") % (self.amount,) else: amount = self.amount name = _('Down Payment') + del context taxes = self.product_id.taxes_id.filtered(lambda r: not order.company_id or r.company_id == order.company_id) if order.fiscal_position_id and taxes: tax_ids = order.fiscal_position_id.map_tax(taxes).ids @@ -152,6 +154,7 @@ class SaleAdvancePaymentInv(models.TransientModel): tax_ids = order.fiscal_position_id.map_tax(taxes).ids else: tax_ids = taxes.ids + context = {'lang': order.partner_id.lang} so_line = sale_line_obj.create({ 'name': _('Advance: %s') % (time.strftime('%m %Y'),), 'price_unit': amount, @@ -162,6 +165,7 @@ class SaleAdvancePaymentInv(models.TransientModel): 'product_id': self.product_id.id, 'tax_id': [(6, 0, tax_ids)], }) + del context self._create_invoice(order, so_line, amount) if self._context.get('open_invoices', False): return sale_orders.action_view_invoice()