[MERGE] [FIX] ir_fields: allow convertion from string to html using sanitize function

This is required to be able to import csv file containing html fields

lp bug: https://launchpad.net/bugs/1093800 fixed

bzr revid: mat@openerp.com-20140206084708-j63kpkr9apd3j01j
This commit is contained in:
Martin Trigaux
2014-02-06 09:47:08 +01:00
+4
View File
@@ -12,6 +12,7 @@ from openerp.osv import orm
from openerp.tools.translate import _
from openerp.tools.misc import DEFAULT_SERVER_DATE_FORMAT,\
DEFAULT_SERVER_DATETIME_FORMAT
from openerp.tools import html_sanitize
REFERENCING_FIELDS = set([None, 'id', '.id'])
def only_ref_fields(record):
@@ -182,6 +183,9 @@ class ir_fields_converter(orm.Model):
_(u"'%s' does not seem to be a number for field '%%(field)s'")
% value)
def _str_to_html(self, cr, uid, model, column, value, context=None):
return html_sanitize(value), []
def _str_id(self, cr, uid, model, column, value, context=None):
return value, []
_str_to_reference = _str_to_char = _str_to_text = _str_to_binary = _str_id