From 06df99de663426358a9a864c28d3c2e5c972f4ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul=20=28ACSONE=29?= Date: Sun, 20 Nov 2016 23:18:01 +0100 Subject: [PATCH] [FIX] server_environment_ir_config_parameter: work around double ormcache issue --- .../models/ir_config_parameter.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/server_environment_ir_config_parameter/models/ir_config_parameter.py b/server_environment_ir_config_parameter/models/ir_config_parameter.py index c92153dee..819ef8f62 100644 --- a/server_environment_ir_config_parameter/models/ir_config_parameter.py +++ b/server_environment_ir_config_parameter/models/ir_config_parameter.py @@ -4,7 +4,6 @@ from openerp import api, models, _, SUPERUSER_ID from openerp.exceptions import UserError -from openerp.tools import ormcache from openerp.addons.server_environment import serv_config @@ -16,9 +15,9 @@ class IrConfigParameter(models.Model): _inherit = 'ir.config_parameter' - @ormcache('uid', 'key') - def _get_param(self, cr, uid, key): - value = super(IrConfigParameter, self)._get_param(cr, uid, key) + def get_param(self, cr, uid, key, default=False, context=None): + value = super(IrConfigParameter, self).get_param( + cr, uid, key, default=None, context=context) if serv_config.has_option(SECTION, key): cvalue = serv_config.get(SECTION, key) if cvalue != value: @@ -29,7 +28,9 @@ class IrConfigParameter(models.Model): self.set_param( cr, SUPERUSER_ID, key, cvalue, context={CTX_NO_CHECK: True}) - return cvalue + value = cvalue + if value is None: + return default return value def _check_not_in_config(self, keys):