[FIX] _register_hook & loader

lp bug: https://launchpad.net/bugs/944197 fixed

bzr revid: api@openerp.com-20121204161029-3gagt4lcci93g5lk
This commit is contained in:
Arnaud Pineux 2012-12-04 17:10:29 +01:00
commit 133d581273
2 changed files with 10 additions and 0 deletions

View File

@ -416,6 +416,12 @@ def load_modules(db, force_demo=False, status=None, update_module=False):
_logger.error('At least one test failed when loading the modules.')
else:
_logger.info('Modules loaded.')
# STEP 7: for every model call _register_hook
for models in pool.models:
pool_mod = pool.get(models)
pool_mod._register_hook(cr)
finally:
cr.close()

View File

@ -5166,6 +5166,10 @@ class BaseModel(object):
# for backward compatibility
resolve_o2m_commands_to_record_dicts = resolve_2many_commands
def _register_hook(self, cr):
""" This method is called right after the registry is filled """
pass
# keep this import here, at top it will cause dependency cycle errors
import expression