我想继承类html并重新定义在html classe中的osv/fields.py中定义的方法_symbol_f(x)该calss的定义如下:
class text(_column):
_type = 'text'
class html(text):
_type = 'html'
_symbol_c = '%s'
def _symbol_f(x):
if x is None or x == False:
return None
return html_sanitize(x)
_symbol_set = (_symbol_c, _symbol_f)
我想重新定义方法symbol_f(x),所以我在文件wiki_html.py中创建了类wiki_html,如下所示
from openerp.osv import fields, osv
class wiki_html(fields.html):
_type = 'html'
_symbol_c = '%s'
def _symbol_f(x):
if x is None or x == False:
return None
return html_sanitize_h(x)
_symbol_set = (_symbol_c, _symbol_f)
现在我定义了一个如下的字段:
'demandes_description':wiki_html('Description demande'),
但我总是犯这样的错误:
openerp.osv.orm: <class 'openerp.addons.....wiki_html'> type not supported!
尝试用fields.wiki_html.调用字段
'demandes_description':fields.wiki_html('Description demande'),