summaryrefslogtreecommitdiff
path: root/openerp/modules/loading.py
diff options
context:
space:
mode:
authorVo Minh Thu <vmt@openerp.com>2011-10-03 17:35:09 +0200
committerVo Minh Thu <vmt@openerp.com>2011-10-03 17:35:09 +0200
commitd9b6f5e2d0d0c30e4e55bc72454b6ec4b720232c (patch)
tree14eb229c961e3413abd06b6ad1a86d64d2d3a2ab /openerp/modules/loading.py
parentfbb6e5e56aaf36ff652edbec0181a0fcb95a3601 (diff)
parentbf3d0d604c89edfd709603c8ca261d020e9ac748 (diff)
[MERGE] merged trunk.
bzr revid: vmt@openerp.com-20111003153509-8mbfg1t8hm92pult
Diffstat (limited to 'openerp/modules/loading.py')
-rw-r--r--openerp/modules/loading.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/openerp/modules/loading.py b/openerp/modules/loading.py
index 45a466e5462..b06368ba1b2 100644
--- a/openerp/modules/loading.py
+++ b/openerp/modules/loading.py
@@ -158,7 +158,7 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, skip_modules=
logger.info('module %s: loading objects', package.name)
migrations.migrate_module(package, 'pre')
register_module_classes(package.name)
- models = pool.instanciate(package.name, cr)
+ models = pool.load(cr, package)
loaded_modules.append(package.name)
if hasattr(package, 'init') or hasattr(package, 'update') or package.state in ('to install', 'to upgrade'):
init_module_models(cr, package.name, models)
@@ -273,8 +273,6 @@ def load_modules(db, force_demo=False, status=None, update_module=False):
# This is a brand new pool, just created in pooler.get_db_and_pool()
pool = pooler.get_pool(cr.dbname)
- processed_modules = [] # for cleanup step after install
- loaded_modules = [] # to avoid double loading
report = tools.assertion_report()
if 'base' in tools.config['update'] or 'all' in tools.config['update']:
cr.execute("update ir_module_module set state=%s where name=%s and state=%s", ('to upgrade', 'base', 'installed'))
@@ -285,8 +283,10 @@ def load_modules(db, force_demo=False, status=None, update_module=False):
if not graph:
logger.notifyChannel('init', netsvc.LOG_CRITICAL, 'module base cannot be loaded! (hint: verify addons-path)')
raise osv.osv.except_osv(_('Could not load base module'), _('module base cannot be loaded! (hint: verify addons-path)'))
- loaded, processed = load_module_graph(cr, graph, status, perform_checks=(not update_module), report=report)
- processed_modules.extend(processed)
+
+ # processed_modules: for cleanup step after install
+ # loaded_modules: to avoid double loading
+ loaded_modules, processed_modules = load_module_graph(cr, graph, status, perform_checks=(not update_module), report=report)
if tools.config['load_language']:
for lang in tools.config['load_language'].split(','):
@@ -339,16 +339,16 @@ def load_modules(db, force_demo=False, status=None, update_module=False):
cr.execute("""select model,name from ir_model where id NOT IN (select distinct model_id from ir_model_access)""")
for (model, name) in cr.fetchall():
model_obj = pool.get(model)
- if model_obj and not isinstance(model_obj, osv.osv.osv_memory):
- logger.notifyChannel('init', netsvc.LOG_WARNING, 'object %s (%s) has no access rules!' % (model, name))
+ if model_obj and not model_obj.is_transient():
+ logger.notifyChannel('init', netsvc.LOG_WARNING, 'Model %s (%s) has no access rules!' % (model, name))
# Temporary warning while we remove access rights on osv_memory objects, as they have
# been replaced by owner-only access rights
cr.execute("""select distinct mod.model, mod.name from ir_model_access acc, ir_model mod where acc.model_id = mod.id""")
for (model, name) in cr.fetchall():
model_obj = pool.get(model)
- if isinstance(model_obj, osv.osv.osv_memory):
- logger.notifyChannel('init', netsvc.LOG_WARNING, 'In-memory object %s (%s) should not have explicit access rules!' % (model, name))
+ if model_obj and model_obj.is_transient():
+ logger.notifyChannel('init', netsvc.LOG_WARNING, 'The transient model %s (%s) should not have explicit access rules!' % (model, name))
cr.execute("SELECT model from ir_model")
for (model,) in cr.fetchall():
@@ -356,7 +356,7 @@ def load_modules(db, force_demo=False, status=None, update_module=False):
if obj:
obj._check_removed_columns(cr, log=True)
else:
- logger.notifyChannel('init', netsvc.LOG_WARNING, "Model %s is referenced but not present in the orm pool!" % model)
+ logger.notifyChannel('init', netsvc.LOG_WARNING, "Model %s is declared but cannot be loaded! (Perhaps a module was partially removed or renamed)" % model)
# Cleanup orphan records
pool.get('ir.model.data')._process_end(cr, 1, processed_modules)