server_environment_ir_config_parameter: work around double ormcache issue
This commit is contained in:
parent
4041930025
commit
b7ab912369
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
from openerp import api, models, _, SUPERUSER_ID
|
from openerp import api, models, _, SUPERUSER_ID
|
||||||
from openerp.exceptions import UserError
|
from openerp.exceptions import UserError
|
||||||
from openerp.tools import ormcache
|
|
||||||
from openerp.addons.server_environment import serv_config
|
from openerp.addons.server_environment import serv_config
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -16,9 +15,9 @@ class IrConfigParameter(models.Model):
|
||||||
|
|
||||||
_inherit = 'ir.config_parameter'
|
_inherit = 'ir.config_parameter'
|
||||||
|
|
||||||
@ormcache('uid', 'key')
|
def get_param(self, cr, uid, key, default=False, context=None):
|
||||||
def _get_param(self, cr, uid, key):
|
value = super(IrConfigParameter, self).get_param(
|
||||||
value = super(IrConfigParameter, self)._get_param(cr, uid, key)
|
cr, uid, key, default=None, context=context)
|
||||||
if serv_config.has_option(SECTION, key):
|
if serv_config.has_option(SECTION, key):
|
||||||
cvalue = serv_config.get(SECTION, key)
|
cvalue = serv_config.get(SECTION, key)
|
||||||
if cvalue != value:
|
if cvalue != value:
|
||||||
|
|
@ -29,7 +28,9 @@ class IrConfigParameter(models.Model):
|
||||||
self.set_param(
|
self.set_param(
|
||||||
cr, SUPERUSER_ID, key, cvalue,
|
cr, SUPERUSER_ID, key, cvalue,
|
||||||
context={CTX_NO_CHECK: True})
|
context={CTX_NO_CHECK: True})
|
||||||
return cvalue
|
value = cvalue
|
||||||
|
if value is None:
|
||||||
|
return default
|
||||||
return value
|
return value
|
||||||
|
|
||||||
def _check_not_in_config(self, keys):
|
def _check_not_in_config(self, keys):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue