osv中继承类html时出错/字段.pyPython/openerp7?

2024-04-19 13:38:42 发布

您现在位置:Python中文网/ 问答频道 /正文

我想继承类html并重新定义在osv中定义的methode\u symbol\u f(x)/字段.py在html类中 该计算的定义如下:

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)

我想重新定义方法\u symbol \u f(x),所以我在wiki文件中创建了类wiki \u html_html.py文件如下所示

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!

Tags: textpynonereturnif定义isdef