[MERGE] merged trunk.
[odoo/odoo.git] / openerp / modules / loading.py
index 551947c..5d274f6 100644 (file)
@@ -31,6 +31,7 @@ import logging
 import os
 import re
 import sys
+import threading
 import zipfile
 import zipimport
 
@@ -97,11 +98,13 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, skip_modules=
         cr.commit()
         if not tools.config.options['test_disable']:
             try:
+                threading.currentThread().testing = True
                 _load_data(cr, module_name, idref, mode, 'test')
             except Exception, e:
                 logging.getLogger('init.test').exception(
                     'Tests failed to execute in module %s', module_name)
             finally:
+                threading.currentThread().testing = False
                 if tools.config.options['test_commit']:
                     cr.commit()
                 else:
@@ -281,7 +284,7 @@ def load_modules(db, force_demo=False, status=None, update_module=False):
 
         # STEP 1: LOAD BASE (must be done before module dependencies can be computed for later steps) 
         graph = openerp.modules.graph.Graph()
-        graph.add_module(cr, 'base', force)
+        graph.add_module(cr, 'base', force_demo)
         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)'))
@@ -307,7 +310,8 @@ def load_modules(db, force_demo=False, status=None, update_module=False):
                 modobj.update_list(cr, 1)
 
             if 'all' in tools.config['init']:
-                pass
+                ids = modobj.search(cr, 1, [])
+                tools.config['init'] = dict.fromkeys([m['name'] for m in modobj.read(cr, 1, ids, ['name'])], 1)
 
             _check_module_names(cr, itertools.chain(tools.config['init'].keys(), tools.config['update'].keys()))