Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Error in Inheritance of class html in osv/fields.py Python/openerp 7 ?

By
kaisusr
on 2/14/15, 7:30 AM 521 views

i want to inherit the class html and to redefine the methode _symbol_f(x) which is defined in osv/fields.py in html classe the definition of this calss is the following:

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)

i want to redefine the method _symbol_f(x), so i have created the class wiki_html in the file wiki_html.py like the following

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)

and now i define a field like the following:

'demandes_description':wiki_html('Description demande'),

but i have always this error:

openerp.osv.orm: <class 'openerp.addons.....wiki_html'> type not supported!

please help !!

 

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 2/14/15, 7:30 AM
Seen: 521 times
Last updated: 3/16/15, 8:10 AM