Skip to content

Commit

Permalink
[FIX] sale: Description of the product 'Downpayment' not translated
Browse files Browse the repository at this point in the history
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:803977
  • Loading branch information
simongoffin committed Jan 9, 2018
1 parent ba2a83d commit a7c0819
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions addons/sale/wizard/sale_make_invoice_advance.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,14 @@ def _create_invoice(self, order, so_line, amount):

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
Expand Down Expand Up @@ -152,6 +154,7 @@ def create_invoices(self):
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,
Expand All @@ -163,6 +166,7 @@ def create_invoices(self):
'tax_id': [(6, 0, tax_ids)],
'is_downpayment': True,
})
del context
self._create_invoice(order, so_line, amount)
if self._context.get('open_invoices', False):
return sale_orders.action_view_invoice()
Expand Down

0 comments on commit a7c0819

Please sign in to comment.