[FIX] currency: simple quote in currency symbols

Escape the currency symbol to prevent javascript errors,
for instance when reconciling a bank statement
(with the special reconciliation widget)

Closes #8216
This commit is contained in:
Colin Newell 2015-08-24 18:46:24 +01:00 committed by Denis Ledoux
parent 617ef49959
commit 84857a3f4f
1 changed files with 3 additions and 2 deletions

View File

@ -28,6 +28,7 @@ from openerp import tools
from openerp.osv import fields, osv
from openerp.tools import float_round, float_is_zero, float_compare
from openerp.tools.translate import _
import simplejson as json
CURRENCY_DISPLAY_PATTERN = re.compile(r'(\w+)\s*(?:\((.*)\))?')
@ -291,9 +292,9 @@ class res_currency(osv.osv):
format_number_str = "openerp.web.format_value(arguments[0], {type: 'float', digits: [69," + str(digits) + "]}, 0.00)"
if row['position'] == 'after':
return_str = "return " + format_number_str + " + '\\xA0" + symbol + "';"
return_str = "return " + format_number_str + " + '\\xA0' + " + json.dumps(symbol) + ";"
else:
return_str = "return '" + symbol + "\\xA0' + " + format_number_str + ";"
return_str = "return " + json.dumps(symbol) + " + '\\xA0' + " + format_number_str + ";"
function += "if (arguments[1] === " + str(row['id']) + ") { " + return_str + " }"
return function