Automatic instanciation doesn't call __new__
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Server (MOVED TO GITHUB) |
Incomplete
|
Low
|
OpenERP's Framework R&D |
Bug Description
Since we can create an object with explicitly instanciating it, the __new__ methods are not called anymore. Here is an example :
class test(osv.osv):
_name = 'test.test'
_columns = {'test' : fields.
def __new__(cls, *args, **kwargs):
print 'NEW CALLED'
return super(test, cls).__new__(cls, *args, **kwargs)
#test()
In this example, the __new__ method will never be called. Uncomment the instanciation, and it will. The problem is the makeInstance() method : http://
It calls the object.__new__ instead of calling the create class __new__ method. Please fix it, because it might break some v6.0 modules. Thanks for reading !
Changed in openobject-server: | |
assignee: | nobody → OpenERP's Framework R&D (openerp-dev-framework) |
importance: | Undecided → Low |
status: | New → Confirmed |
Thibaut,
You are right that we call object.__new__ but this is not something new in trunk (i.e. it is the same thing in 6.0).
Is it really a problem for you? Can you give a use case where you want your own __new__to be called instead of __init__?