|
@ -23,7 +23,7 @@ import os |
|
|
import ConfigParser |
|
|
import ConfigParser |
|
|
from lxml import etree |
|
|
from lxml import etree |
|
|
|
|
|
|
|
|
from openerp.osv import osv, fields, orm |
|
|
|
|
|
|
|
|
from openerp.osv import fields, orm |
|
|
from openerp.tools.config import config as system_base_config |
|
|
from openerp.tools.config import config as system_base_config |
|
|
|
|
|
|
|
|
from .system_info import get_server_environment |
|
|
from .system_info import get_server_environment |
|
@ -46,12 +46,13 @@ if not system_base_config.get('running_env', False): |
|
|
|
|
|
|
|
|
ck_path = os.path.join(_dir, system_base_config['running_env']) |
|
|
ck_path = os.path.join(_dir, system_base_config['running_env']) |
|
|
|
|
|
|
|
|
if not os.path.exists(ck_path) : |
|
|
|
|
|
|
|
|
if not os.path.exists(ck_path): |
|
|
raise Exception( |
|
|
raise Exception( |
|
|
"Provided server environment does not exist, " |
|
|
"Provided server environment does not exist, " |
|
|
"please add a folder %s" % ck_path |
|
|
"please add a folder %s" % ck_path |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def setboolean(obj, attr, _bool=_boolean_states): |
|
|
def setboolean(obj, attr, _bool=_boolean_states): |
|
|
"""Replace the attribute with a boolean.""" |
|
|
"""Replace the attribute with a boolean.""" |
|
|
res = _bool[getattr(obj, attr).lower()] |
|
|
res = _bool[getattr(obj, attr).lower()] |
|
@ -115,7 +116,7 @@ class ServerConfiguration(orm.TransientModel): |
|
|
_conf_defaults = _Defaults() |
|
|
_conf_defaults = _Defaults() |
|
|
|
|
|
|
|
|
def __init__(self, pool, cr): |
|
|
def __init__(self, pool, cr): |
|
|
res = super(ServerConfiguration, self).__init__(pool, cr) |
|
|
|
|
|
|
|
|
super(ServerConfiguration, self).__init__(pool, cr) |
|
|
self.running_env = system_base_config['running_env'] |
|
|
self.running_env = system_base_config['running_env'] |
|
|
# Only show passwords in development |
|
|
# Only show passwords in development |
|
|
self.show_passwords = self.running_env in ('dev',) |
|
|
self.show_passwords = self.running_env in ('dev',) |
|
@ -187,7 +188,6 @@ class ServerConfiguration(orm.TransientModel): |
|
|
res['fields'] = xfields |
|
|
res['fields'] = xfields |
|
|
return res |
|
|
return res |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def default_get(self, cr, uid, fields_list, context=None): |
|
|
def default_get(self, cr, uid, fields_list, context=None): |
|
|
res = {} |
|
|
res = {} |
|
|
for key in self._conf_defaults: |
|
|
for key in self._conf_defaults: |
|
|