[FIX] osv_pool: it appears it is necessary to have the model in the pool earlier on.

bzr revid: vmt@openerp.com-20110527100310-qw9760rd8spiwjgm
This commit is contained in:
Vo Minh Thu 2011-05-27 12:03:10 +02:00
parent a87ebe9600
commit ee58f9da5f
2 changed files with 2 additions and 3 deletions

View File

@ -639,6 +639,7 @@ class orm_template(object):
def __init__(self, pool, cr):
""" Initialize a model and make it part of the given registry."""
pool.add(self._name, self)
self.pool = pool
if not self._name and not hasattr(self, '_inherit'):

View File

@ -243,9 +243,7 @@ class osv_pool(object):
# Instanciate classes registered through their constructor and
# add them to the pool.
for klass in module_class_list.get(module, []):
inst = klass.createInstance(self, module, cr)
self.add(inst._name, inst)
res.append(inst)
res.append(klass.createInstance(self, module, cr))
return res