From b7a001866d4e4b97e12aba654abf4d5273baf3d6 Mon Sep 17 00:00:00 2001 From: jke-openerp Date: Wed, 18 Dec 2013 13:38:58 +0100 Subject: [PATCH] [IMP] Move threading.currentThread().testing from load_test to load_data. The purpose is to dont send mail when we are installing the demo data bzr revid: jke@openerp.com-20131218123858-09hitdpxxqa5uh3j --- openerp/modules/loading.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/openerp/modules/loading.py b/openerp/modules/loading.py index 9a5533f5caa..48c5c5adab5 100644 --- a/openerp/modules/loading.py +++ b/openerp/modules/loading.py @@ -59,7 +59,6 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, skip_modules= def load_test(module_name, idref, mode): cr.commit() try: - threading.currentThread().testing = True _load_data(cr, module_name, idref, mode, 'test') return True except Exception: @@ -67,7 +66,6 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, skip_modules= 'module %s: an exception occurred in a test', module_name) return False finally: - threading.currentThread().testing = False if tools.config.options['test_commit']: cr.commit() else: @@ -104,12 +102,18 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, skip_modules= init mode. """ - for filename in _get_files_of_kind(kind): - _logger.info("module %s: loading %s", module_name, filename) - noupdate = False - if kind in ('demo', 'demo_xml') or (filename.endswith('.csv') and kind in ('init', 'init_xml')): - noupdate = True - tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report) + try: + if kind in ('demo', 'test'): + threading.currentThread().testing = True + for filename in _get_files_of_kind(kind): + _logger.info("module %s: loading %s", module_name, filename) + noupdate = False + if kind in ('demo', 'demo_xml') or (filename.endswith('.csv') and kind in ('init', 'init_xml')): + noupdate = True + tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report) + finally: + if kind in ('demo', 'test'): + threading.currentThread().testing = False if status is None: status = {}