Check price_decimal configuration
The price_decimal stored in ir.configuration is checked against the current configuration value. We do not allow to start serving a database for which the values are different as it may be due to a misconfiguration which can lead to data corruption. issue9324 review317381002
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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')))
|
||||
|
||||
+7
-2
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user