← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 822735] Re: Automatic instanciation doesn't call __new__

 

** Changed in: openobject-server
   Importance: Undecided => Low

** Changed in: openobject-server
       Status: New => Confirmed

** Changed in: openobject-server
     Assignee: (unassigned) => OpenERP's Framework R&D (openerp-dev-framework)

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/822735

Title:
  Automatic instanciation doesn't call __new__

Status in OpenERP Server:
  Confirmed

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.boolean('True/False')}

      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://bazaar.launchpad.net/~openerp/openobject-
  server/trunk/view/head:/openerp/osv/orm.py#L804 !

  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 !

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/822735/+subscriptions


References