[FIX] orm : fixed bug after imporved stuff of hasattr

bzr revid: hmo@tinyerp.com-20100112115044-443q61a9r3jlpkbj
This commit is contained in:
Harry (Open ERP)
2010-01-12 17:20:44 +05:30
parent 0f27fbeb51
commit a0be2f8e46
+5 -5
View File
@@ -194,10 +194,10 @@ class osv_memory(osv_base, orm.orm_memory):
# Goal: try to apply inheritancy at the instanciation level and
# put objects in the pool var
#
def createInstance(cls, pool, module, cr):
name = getattr(cls, '_name', cls._inherit)
def createInstance(cls, pool, module, cr):
parent_names = getattr(cls, '_inherit', None)
if parent_names:
name = getattr(cls, '_name', cls._inherit)
for parent_name in ((type(parent_names)==list) and parent_names or [parent_names]):
parent_class = pool.get(parent_name).__class__
assert pool.get(parent_name), "parent class %s does not exist in module %s !" % (parent_name, module)
@@ -223,7 +223,7 @@ class osv(osv_base, orm.orm):
# put objects in the pool var
#
def createInstance(cls, pool, module, cr):
parent_names = getattr(cls, '_inherit', None)
parent_names = getattr(cls, '_inherit', None)
if parent_names:
for parent_name in ((type(parent_names)==list) and parent_names or [parent_names]):
parent_class = pool.get(parent_name).__class__
@@ -246,8 +246,8 @@ class osv(osv_base, orm.orm):
new.append(c)
else:
new.extend(cls.__dict__.get(s, []))
nattr[s] = new
name = getattr(cls, '_name', cls._inherit)
nattr[s] = new
name = hasattr(cls, '_name') and cls._name or cls._inherit
cls = type(name, (cls, parent_class), nattr)
obj = object.__new__(cls)
obj.__init__(pool, cr)