I've tried without any success to inherit from one2many field. I wanted to override some methods in the new class but when openerp tries to load the module it shows a CRITICAL error in the log (no special message to understand what is the problem)
What I intended to do in my python source file is something like this:
Code:
from osv import fields
#class inherited from fields.one2many
class x_one2many(fields.one2many):
_inout = None
def __init__(self, obj, fields_id, string='unknown', limit=None, inout, **args):
fields.one2many.__init__(self, obj, fields_id, string, limit, args)
self._domain = [('type', '=', inout)]
self._inout = inout
def get(....)
new get() code here
...
class X(osv.osv):
...
_columns = {
col1= fields. ...,
...
coln= fields. ...,
'coly': x_one2many('y', x_id', 'name', readonly=True, inout='in'),
}
X()
...
class Y(osv.osv):
...
Y()
[/code]
even if I don't use x_one2many class in the code, the module doesn't load. What could be the problem?