diff --git a/addons/sale/wizard/sale_make_invoice_advance.py b/addons/sale/wizard/sale_make_invoice_advance.py index 9c3160cb46a..c4798cc44d4 100644 --- a/addons/sale/wizard/sale_make_invoice_advance.py +++ b/addons/sale/wizard/sale_make_invoice_advance.py @@ -58,6 +58,9 @@ class sale_advance_payment_inv(osv.osv_memory): 'product_id': _get_advance_product, } + def _translate_advance(self, cr, uid, percentage=False, context=None): + return _("Advance of %s %%") if percentage else _("Advance of %s %s") + def onchange_method(self, cr, uid, ids, advance_payment_method, product_id, context=None): if advance_payment_method == 'percentage': return {'value': {'amount':0, 'product_id':False }} @@ -104,16 +107,17 @@ class sale_advance_payment_inv(osv.osv_memory): if wizard.advance_payment_method == 'percentage': inv_amount = sale.amount_total * wizard.amount / 100 if not res.get('name'): - res['name'] = _("Advance of %s %%") % (wizard.amount) + res['name'] = self._translate_advance(cr, uid, percentage=True, context=dict(context, lang=sale.partner_id.lang)) % (wizard.amount) else: inv_amount = wizard.amount if not res.get('name'): #TODO: should find a way to call formatLang() from rml_parse symbol = sale.pricelist_id.currency_id.symbol if sale.pricelist_id.currency_id.position == 'after': - res['name'] = _("Advance of %s %s") % (inv_amount, symbol) + symbol_order = (inv_amount, symbol) else: - res['name'] = _("Advance of %s %s") % (symbol, inv_amount) + symbol_order = (symbol, inv_amount) + res['name'] = self._translate_advance(cr, uid, context=dict(context, lang=sale.partner_id.lang)) % symbol_order # determine taxes if res.get('invoice_line_tax_id'): @@ -159,7 +163,6 @@ class sale_advance_payment_inv(osv.osv_memory): sale_obj.write(cr, uid, sale_id, {'invoice_ids': [(4, inv_id)]}, context=context) return inv_id - def create_invoices(self, cr, uid, ids, context=None): """ create invoices for the active sales orders """ sale_obj = self.pool.get('sale.order')