@@ -58,6 +58,9 @@ def _get_advance_product(self, cr, uid, context=None):
58
58
'product_id' : _get_advance_product ,
59
59
}
60
60
61
+ def _translate_advance (self , cr , uid , percentage = False , context = None ):
62
+ return _ ("Advance of %s %%" ) if percentage else _ ("Advance of %s %s" )
63
+
61
64
def onchange_method (self , cr , uid , ids , advance_payment_method , product_id , context = None ):
62
65
if advance_payment_method == 'percentage' :
63
66
return {'value' : {'amount' :0 , 'product_id' :False }}
@@ -104,16 +107,17 @@ def _prepare_advance_invoice_vals(self, cr, uid, ids, context=None):
104
107
if wizard .advance_payment_method == 'percentage' :
105
108
inv_amount = sale .amount_total * wizard .amount / 100
106
109
if not res .get ('name' ):
107
- res ['name' ] = _ ( "Advance of %s %%" ) % (wizard .amount )
110
+ res ['name' ] = self . _translate_advance ( cr , uid , percentage = True , context = dict ( context , lang = sale . partner_id . lang ) ) % (wizard .amount )
108
111
else :
109
112
inv_amount = wizard .amount
110
113
if not res .get ('name' ):
111
114
#TODO: should find a way to call formatLang() from rml_parse
112
115
symbol = sale .pricelist_id .currency_id .symbol
113
116
if sale .pricelist_id .currency_id .position == 'after' :
114
- res [ 'name' ] = _ ( "Advance of %s %s" ) % (inv_amount , symbol )
117
+ symbol_order = (inv_amount , symbol )
115
118
else :
116
- res ['name' ] = _ ("Advance of %s %s" ) % (symbol , inv_amount )
119
+ symbol_order = (symbol , inv_amount )
120
+ res ['name' ] = self ._translate_advance (cr , uid , context = dict (context , lang = sale .partner_id .lang )) % symbol_order
117
121
118
122
# determine taxes
119
123
if res .get ('invoice_line_tax_id' ):
@@ -159,7 +163,6 @@ def _create_invoices(self, cr, uid, inv_values, sale_id, context=None):
159
163
sale_obj .write (cr , uid , sale_id , {'invoice_ids' : [(4 , inv_id )]}, context = context )
160
164
return inv_id
161
165
162
-
163
166
def create_invoices (self , cr , uid , ids , context = None ):
164
167
""" create invoices for the active sales orders """
165
168
sale_obj = self .pool .get ('sale.order' )
0 commit comments