[FIX] 'create_instance' method: the check for parent_model existence need to be done before accessing that object attributes or methods

bzr revid: olt@tinyerp.com-20120309081929-g4b8d34e93at49wf
This commit is contained in:
olt@tinyerp.com 2012-03-09 09:19:29 +01:00
parent e08cb5e606
commit 6aa9f06dae
1 changed files with 2 additions and 2 deletions

View File

@ -872,11 +872,11 @@ class BaseModel(object):
for parent_name in ((type(parent_names)==list) and parent_names or [parent_names]):
parent_model = pool.get(parent_name)
if not getattr(cls, '_original_module', None) and name == parent_model._name:
cls._original_module = parent_model._original_module
if not parent_model:
raise TypeError('The model "%s" specifies an unexisting parent class "%s"\n'
'You may need to add a dependency on the parent class\' module.' % (name, parent_name))
if not getattr(cls, '_original_module', None) and name == parent_model._name:
cls._original_module = parent_model._original_module
parent_class = parent_model.__class__
nattr = {}
for s in attributes: