Browse Source

[IMP] registry loading: setup models only if necessary

When loading the registry without any module installation/upgrade, models are
set up once instead of twice.  In other cases, models are always set up before
installations/upgrades.
master
Raphael Collet 7 years ago
parent
commit
d9fedfebbd
  1. 6
      openerp/modules/loading.py

6
openerp/modules/loading.py

@ -225,8 +225,6 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, skip_modules=
registry._init_modules.add(package.name)
cr.commit()
registry.setup_models(cr, partial=True)
_logger.log(25, "%s modules loaded in %.2fs, %s queries", len(graph), time.time() - t0, openerp.sql_db.sql_counter - t0_sql)
# The query won't be valid for models created later (i.e. custom model
@ -306,6 +304,10 @@ def load_modules(db, force_demo=False, status=None, update_module=False):
report = registry._assertion_report
loaded_modules, processed_modules = load_module_graph(cr, graph, status, perform_checks=update_module, report=report)
if tools.config['load_language'] or update_module:
# some base models are used below, so make sure they are set up
registry.setup_models(cr, partial=True)
if tools.config['load_language']:
for lang in tools.config['load_language'].split(','):
tools.load_language(cr, lang)

Loading…
Cancel
Save