[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
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user