diff --git a/CHANGELOG b/CHANGELOG index 25071177a6..4eab53976e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Add configuration check * Add support for properties to fields.depends * Allow combining authentication methods together * Add context to export CSV route diff --git a/trytond/ir/configuration.py b/trytond/ir/configuration.py index d11eb39b41..5e580725dd 100644 --- a/trytond/ir/configuration.py +++ b/trytond/ir/configuration.py @@ -29,3 +29,7 @@ class Configuration(ModelSingleton, ModelSQL): language = config.get('database', 'language') cls._get_language_cache.set(None, language) return language + + def check(self): + "Check configuration coherence on pool initialisation" + pass diff --git a/trytond/modules/__init__.py b/trytond/modules/__init__.py index 9329475bbf..5ae97e345b 100644 --- a/trytond/modules/__init__.py +++ b/trytond/modules/__init__.py @@ -396,6 +396,9 @@ def load_modules( load_module_graph(graph, pool, update, lang) + Configuration = pool.get('ir.configuration') + Configuration(1).check() + if update: cursor.execute(*ir_module.select(ir_module.name, where=(ir_module.state == 'to remove'))) diff --git a/trytond/pool.py b/trytond/pool.py index ddb5390bc2..5ddfedf605 100644 --- a/trytond/pool.py +++ b/trytond/pool.py @@ -158,8 +158,13 @@ class Pool(object): # Clean the _pool before loading modules for type in self.classes.keys(): self._pool[self.database_name][type] = {} - restart = not load_modules(self.database_name, self, update=update, - lang=lang, activatedeps=activatedeps) + try: + restart = not load_modules( + self.database_name, self, update=update, lang=lang, + activatedeps=activatedeps) + except Exception: + del self._pool[self.database_name] + raise if restart: self.init()