[FIX] sale: translate advance message on advance invoice
This commit is contained in:
parent
98c6e7c3d5
commit
9c0e8f10e0
|
@ -58,6 +58,9 @@ class sale_advance_payment_inv(osv.osv_memory):
|
||||||
'product_id': _get_advance_product,
|
'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):
|
def onchange_method(self, cr, uid, ids, advance_payment_method, product_id, context=None):
|
||||||
if advance_payment_method == 'percentage':
|
if advance_payment_method == 'percentage':
|
||||||
return {'value': {'amount':0, 'product_id':False }}
|
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':
|
if wizard.advance_payment_method == 'percentage':
|
||||||
inv_amount = sale.amount_total * wizard.amount / 100
|
inv_amount = sale.amount_total * wizard.amount / 100
|
||||||
if not res.get('name'):
|
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:
|
else:
|
||||||
inv_amount = wizard.amount
|
inv_amount = wizard.amount
|
||||||
if not res.get('name'):
|
if not res.get('name'):
|
||||||
#TODO: should find a way to call formatLang() from rml_parse
|
#TODO: should find a way to call formatLang() from rml_parse
|
||||||
symbol = sale.pricelist_id.currency_id.symbol
|
symbol = sale.pricelist_id.currency_id.symbol
|
||||||
if sale.pricelist_id.currency_id.position == 'after':
|
if sale.pricelist_id.currency_id.position == 'after':
|
||||||
res['name'] = _("Advance of %s %s") % (inv_amount, symbol)
|
symbol_order = (inv_amount, symbol)
|
||||||
else:
|
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
|
# determine taxes
|
||||||
if res.get('invoice_line_tax_id'):
|
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)
|
sale_obj.write(cr, uid, sale_id, {'invoice_ids': [(4, inv_id)]}, context=context)
|
||||||
return inv_id
|
return inv_id
|
||||||
|
|
||||||
|
|
||||||
def create_invoices(self, cr, uid, ids, context=None):
|
def create_invoices(self, cr, uid, ids, context=None):
|
||||||
""" create invoices for the active sales orders """
|
""" create invoices for the active sales orders """
|
||||||
sale_obj = self.pool.get('sale.order')
|
sale_obj = self.pool.get('sale.order')
|
||||||
|
|
Loading…
Reference in New Issue