|
@ -2,9 +2,9 @@ |
|
|
# Copyright 2016 ACSONE SA/NV |
|
|
# Copyright 2016 ACSONE SA/NV |
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|
|
|
|
|
|
|
|
from openerp import api, models, _, SUPERUSER_ID |
|
|
|
|
|
from openerp.exceptions import UserError |
|
|
|
|
|
from openerp.addons.server_environment import serv_config |
|
|
|
|
|
|
|
|
from odoo import api, models, _ |
|
|
|
|
|
from odoo.exceptions import UserError |
|
|
|
|
|
from odoo.addons.server_environment import serv_config |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SECTION = 'ir.config_parameter' |
|
|
SECTION = 'ir.config_parameter' |
|
@ -14,9 +14,9 @@ class IrConfigParameter(models.Model): |
|
|
|
|
|
|
|
|
_inherit = 'ir.config_parameter' |
|
|
_inherit = 'ir.config_parameter' |
|
|
|
|
|
|
|
|
def get_param(self, cr, uid, key, default=False, context=None): |
|
|
|
|
|
value = super(IrConfigParameter, self).get_param( |
|
|
|
|
|
cr, uid, key, default=None, context=context) |
|
|
|
|
|
|
|
|
@api.model |
|
|
|
|
|
def get_param(self, key, default=False): |
|
|
|
|
|
value = super(IrConfigParameter, self).get_param(key, default=None) |
|
|
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 not cvalue: |
|
|
if not cvalue: |
|
@ -28,7 +28,7 @@ class IrConfigParameter(models.Model): |
|
|
# should we have preloaded values in database at, |
|
|
# should we have preloaded values in database at, |
|
|
# server startup, modules loading their parameters |
|
|
# server startup, modules loading their parameters |
|
|
# from data files would break on unique key error. |
|
|
# from data files would break on unique key error. |
|
|
self.set_param(cr, SUPERUSER_ID, key, cvalue) |
|
|
|
|
|
|
|
|
self.set_param(key, cvalue) |
|
|
value = cvalue |
|
|
value = cvalue |
|
|
if value is None: |
|
|
if value is None: |
|
|
return default |
|
|
return default |
|
|