[FIX] core: raise an usefull exception when trying to inherit from an osv_memory
authorChristophe Simonis <chs@openerp.com>
Tue, 10 Aug 2010 09:39:09 +0000 (11:39 +0200)
committerChristophe Simonis <chs@openerp.com>
Tue, 10 Aug 2010 09:39:09 +0000 (11:39 +0200)
bzr revid: chs@openerp.com-20100810093909-2fdipsntu1qpk09q

bin/osv/osv.py

index 17da546..da4c67c 100644 (file)
@@ -191,10 +191,11 @@ class osv_memory(orm.orm_memory):
     #       put objects in the pool var
     #
     def createInstance(cls, pool, module, cr):
-        name = hasattr(cls, '_name') and cls._name or cls._inherit
-        parent_name = hasattr(cls, '_inherit') and cls._inherit
+        parent_name = getattr(cls, '_inherit', None)
+        name = getattr(cls, '_name', parent_name)
         if parent_name:
-            raise 'Inherit not supported in osv_memory object !'
+            raise NotImplementedError('Inherit not supported in osv_memory object (%s) !' % (parent_name,))
+
         obj = object.__new__(cls)
         obj.__init__(pool, cr)
         return obj