From e1d8e4ffe90db1ad8eef864f535099e43b38de02 Mon Sep 17 00:00:00 2001 From: Nicolas Bessi Date: Tue, 9 Sep 2014 08:59:47 +0200 Subject: [PATCH 01/10] Moving server environment module and sample module --- .../server_environment => server_environment}/__init__.py | 0 .../server_environment => server_environment}/__openerp__.py | 0 .../i18n/server_environment.pot | 0 .../server_environment => server_environment}/serv_config.py | 0 .../server_environment => server_environment}/serv_config.xml | 0 .../server_environment => server_environment}/system_info.py | 0 .../__init__.py | 0 .../__openerp__.py | 0 .../default/base.conf | 0 .../default/mytopic.conf | 0 .../dev/base.conf | 0 .../dev/mytopic.conf | 0 .../i18n/server_environment_files.pot | 0 .../preprod/mytopic.conf | 0 .../prod/base.conf | 0 .../prod/mytopic.conf | 0 16 files changed, 0 insertions(+), 0 deletions(-) rename {__unported__/server_environment => server_environment}/__init__.py (100%) rename {__unported__/server_environment => server_environment}/__openerp__.py (100%) rename {__unported__/server_environment => server_environment}/i18n/server_environment.pot (100%) rename {__unported__/server_environment => server_environment}/serv_config.py (100%) rename {__unported__/server_environment => server_environment}/serv_config.xml (100%) rename {__unported__/server_environment => server_environment}/system_info.py (100%) rename {__unported__/server_environment_files => server_environment_file_sample}/__init__.py (100%) rename {__unported__/server_environment_files => server_environment_file_sample}/__openerp__.py (100%) rename {__unported__/server_environment_files => server_environment_file_sample}/default/base.conf (100%) rename {__unported__/server_environment_files => server_environment_file_sample}/default/mytopic.conf (100%) rename {__unported__/server_environment_files => server_environment_file_sample}/dev/base.conf (100%) rename {__unported__/server_environment_files => server_environment_file_sample}/dev/mytopic.conf (100%) rename {__unported__/server_environment_files => server_environment_file_sample}/i18n/server_environment_files.pot (100%) rename {__unported__/server_environment_files => server_environment_file_sample}/preprod/mytopic.conf (100%) rename {__unported__/server_environment_files => server_environment_file_sample}/prod/base.conf (100%) rename {__unported__/server_environment_files => server_environment_file_sample}/prod/mytopic.conf (100%) diff --git a/__unported__/server_environment/__init__.py b/server_environment/__init__.py similarity index 100% rename from __unported__/server_environment/__init__.py rename to server_environment/__init__.py diff --git a/__unported__/server_environment/__openerp__.py b/server_environment/__openerp__.py similarity index 100% rename from __unported__/server_environment/__openerp__.py rename to server_environment/__openerp__.py diff --git a/__unported__/server_environment/i18n/server_environment.pot b/server_environment/i18n/server_environment.pot similarity index 100% rename from __unported__/server_environment/i18n/server_environment.pot rename to server_environment/i18n/server_environment.pot diff --git a/__unported__/server_environment/serv_config.py b/server_environment/serv_config.py similarity index 100% rename from __unported__/server_environment/serv_config.py rename to server_environment/serv_config.py diff --git a/__unported__/server_environment/serv_config.xml b/server_environment/serv_config.xml similarity index 100% rename from __unported__/server_environment/serv_config.xml rename to server_environment/serv_config.xml diff --git a/__unported__/server_environment/system_info.py b/server_environment/system_info.py similarity index 100% rename from __unported__/server_environment/system_info.py rename to server_environment/system_info.py diff --git a/__unported__/server_environment_files/__init__.py b/server_environment_file_sample/__init__.py similarity index 100% rename from __unported__/server_environment_files/__init__.py rename to server_environment_file_sample/__init__.py diff --git a/__unported__/server_environment_files/__openerp__.py b/server_environment_file_sample/__openerp__.py similarity index 100% rename from __unported__/server_environment_files/__openerp__.py rename to server_environment_file_sample/__openerp__.py diff --git a/__unported__/server_environment_files/default/base.conf b/server_environment_file_sample/default/base.conf similarity index 100% rename from __unported__/server_environment_files/default/base.conf rename to server_environment_file_sample/default/base.conf diff --git a/__unported__/server_environment_files/default/mytopic.conf b/server_environment_file_sample/default/mytopic.conf similarity index 100% rename from __unported__/server_environment_files/default/mytopic.conf rename to server_environment_file_sample/default/mytopic.conf diff --git a/__unported__/server_environment_files/dev/base.conf b/server_environment_file_sample/dev/base.conf similarity index 100% rename from __unported__/server_environment_files/dev/base.conf rename to server_environment_file_sample/dev/base.conf diff --git a/__unported__/server_environment_files/dev/mytopic.conf b/server_environment_file_sample/dev/mytopic.conf similarity index 100% rename from __unported__/server_environment_files/dev/mytopic.conf rename to server_environment_file_sample/dev/mytopic.conf diff --git a/__unported__/server_environment_files/i18n/server_environment_files.pot b/server_environment_file_sample/i18n/server_environment_files.pot similarity index 100% rename from __unported__/server_environment_files/i18n/server_environment_files.pot rename to server_environment_file_sample/i18n/server_environment_files.pot diff --git a/__unported__/server_environment_files/preprod/mytopic.conf b/server_environment_file_sample/preprod/mytopic.conf similarity index 100% rename from __unported__/server_environment_files/preprod/mytopic.conf rename to server_environment_file_sample/preprod/mytopic.conf diff --git a/__unported__/server_environment_files/prod/base.conf b/server_environment_file_sample/prod/base.conf similarity index 100% rename from __unported__/server_environment_files/prod/base.conf rename to server_environment_file_sample/prod/base.conf diff --git a/__unported__/server_environment_files/prod/mytopic.conf b/server_environment_file_sample/prod/mytopic.conf similarity index 100% rename from __unported__/server_environment_files/prod/mytopic.conf rename to server_environment_file_sample/prod/mytopic.conf From 1563582d0349debc18783a2b801120489d8e2628 Mon Sep 17 00:00:00 2001 From: Nicolas Bessi Date: Tue, 9 Sep 2014 14:11:45 +0200 Subject: [PATCH 02/10] Port server environment to version 8.0 --- server_environment/__openerp__.py | 2 +- server_environment/serv_config.py | 89 ++++++++++++++++++++++++------- 2 files changed, 71 insertions(+), 20 deletions(-) diff --git a/server_environment/__openerp__.py b/server_environment/__openerp__.py index f4c3b29ba..8263a2a3b 100644 --- a/server_environment/__openerp__.py +++ b/server_environment/__openerp__.py @@ -21,7 +21,7 @@ { "name": "server configuration environment files", - "version": "1.0", + "version": "1.1", "depends": ["base", "server_environment_files"], "author": "Camptocamp", "description": """\ diff --git a/server_environment/serv_config.py b/server_environment/serv_config.py index ccac4f007..c7f9670f2 100644 --- a/server_environment/serv_config.py +++ b/server_environment/serv_config.py @@ -22,8 +22,9 @@ import os import ConfigParser from lxml import etree +from itertools import chain -from openerp.osv import fields, orm +from openerp import models, fields from openerp.tools.config import config as system_base_config from .system_info import get_server_environment @@ -109,32 +110,78 @@ class _Defaults(dict): return dict.__setitem__(self, key, func) -class ServerConfiguration(orm.TransientModel): +class ServerConfiguration(models.TransientModel): """Display server configuration.""" _name = 'server.config' - _columns = {} _conf_defaults = _Defaults() def __init__(self, pool, cr): + # env.sudo is not available + self._add_columns() super(ServerConfiguration, self).__init__(pool, cr) self.running_env = system_base_config['running_env'] # Only show passwords in development self.show_passwords = self.running_env in ('dev',) self._arch = None - self._build_osv() - def _group(self, items, prefix): + def _format_key(self, section, key): + return '%s | %s' % (section, key) + + def _add_columns(self): + cols = chain( + self._get_base_cols(), + self._get_env_cols(), + self._get_system_cols() + ) + for col in cols: + print col + setattr(ServerConfiguration, + col, + fields.Char(string=col, readonly=True)) + + def _get_base_cols(self): + """ Compute base fields""" + res = {} + for col, item in system_base_config.options.items(): + key = self._format_key('openerp', col) + # fld = fields.Char(string=col, readonly=True) + # fld.name = key + # fld.model_name = self._model + res[key] = item + self._conf_defaults[key] = item + return res + + def _get_env_cols(self, sections=None): + """ Compute base fields""" + res = {} + sections = sections if sections else serv_config.sections() + for section in sections: + for col, item in serv_config.items(section): + key = self._format_key(section, col) + res[key] = item + self._conf_defaults[key] = item + return res + + def _get_system_cols(self): + """ Compute system fields""" + res = {} + for col, item in get_server_environment(): + key = self._format_key('system', col) + res[key] = item + self._conf_defaults[key] = item + return res + + def _merge_fields_desc(self, cr, user, res, cols, env, context=None): + for col, field in cols.items(): + res[col] = cols[col].get_description(env) + return res + + def _group(self, items): """Return an XML chunk which represents a group of fields.""" names = [] - for k, v in items: - key = '%s\\%s' % (prefix, k) - # Mask passwords - if 'passw' in k and not self.show_passwords: - v = '**********' - self._columns[key] = fields.char(k, size=1024) - self._conf_defaults[key] = v - names.append(key) + for key in sorted(items): + names.append(key) return ('' + ''.join(['' % _escape(name) for name in names]) + @@ -148,23 +195,23 @@ class ServerConfiguration(orm.TransientModel): # OpenERP server configuration rcfile = system_base_config.rcfile - items = sorted(system_base_config.options.items()) + items = self._get_base_cols() arch += '' arch += '' % _escape(rcfile) - arch += self._group(items, prefix='openerp') + arch += self._group(items) arch += '' arch += '' for section in sorted(serv_config.sections()): - items = sorted(serv_config.items(section)) + items = self._get_env_cols(sections=[section]) arch += '' % _escape(section) - arch += self._group(items, prefix=section) + arch += self._group(items) arch += '' # System information arch += '' arch += '' - arch += self._group(get_server_environment(), prefix='system') + arch += self._group(self._get_system_cols()) arch += '' arch += '' @@ -173,6 +220,7 @@ class ServerConfiguration(orm.TransientModel): def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): """Overwrite the default method to render the custom view.""" + self._build_osv() res = super(ServerConfiguration, self).fields_view_get(cr, uid, view_id, view_type, @@ -191,5 +239,8 @@ class ServerConfiguration(orm.TransientModel): def default_get(self, cr, uid, fields_list, context=None): res = {} for key in self._conf_defaults: - res[key] = self._conf_defaults[key]() + if 'passw' in key and not self.show_passwords: + res[key] = '**********' + else: + res[key] = self._conf_defaults[key]() return res From 0771efa10a764b397d1303c41717095defbed711 Mon Sep 17 00:00:00 2001 From: Nicolas Bessi Date: Tue, 9 Sep 2014 14:12:19 +0200 Subject: [PATCH 03/10] Add git support to get revision --- server_environment/system_info.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/server_environment/system_info.py b/server_environment/system_info.py index e6d522d9f..bd0f5fea8 100644 --- a/server_environment/system_info.py +++ b/server_environment/system_info.py @@ -37,9 +37,12 @@ def _get_output(cmd): def get_server_environment(): # inspired by server/bin/service/web_services.py try: - rev_id = _get_output('bzr revision-info') - except Exception as e: - rev_id = 'Exception: %s' % (e,) + rev_id = 'git:%s' % _get_output('git rev-parse HEAD') + except Exception: + try: + rev_id = 'bzr: %s' % _get_output('bzr revision-info') + except Exception: + rev_id = 'Can not retrive revison from git or bzr' os_lang = '.'.join([x for x in locale.getdefaultlocale() if x]) if not os_lang: @@ -50,7 +53,7 @@ def get_server_environment(): lsbinfo = 'not lsb compliant' return ( ('platform', platform.platform()), - ('os.name', os.name), + ('os name', os.name), ('lsb_release', lsbinfo), ('release', platform.release()), ('version', platform.version()), From b8bc5c2e066dbb34a79f29ae4542eeff2262ddd5 Mon Sep 17 00:00:00 2001 From: Nicolas Bessi Date: Tue, 9 Sep 2014 14:21:35 +0200 Subject: [PATCH 04/10] Add doctstring and remove dead code --- server_environment/serv_config.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/server_environment/serv_config.py b/server_environment/serv_config.py index c7f9670f2..472b4db07 100644 --- a/server_environment/serv_config.py +++ b/server_environment/serv_config.py @@ -116,7 +116,10 @@ class ServerConfiguration(models.TransientModel): _conf_defaults = _Defaults() def __init__(self, pool, cr): - # env.sudo is not available + """Add columns to model dynamically + and init some properties + + """ self._add_columns() super(ServerConfiguration, self).__init__(pool, cr) self.running_env = system_base_config['running_env'] @@ -128,6 +131,7 @@ class ServerConfiguration(models.TransientModel): return '%s | %s' % (section, key) def _add_columns(self): + """Add columns to model dynamically""" cols = chain( self._get_base_cols(), self._get_env_cols(), @@ -171,11 +175,6 @@ class ServerConfiguration(models.TransientModel): self._conf_defaults[key] = item return res - def _merge_fields_desc(self, cr, user, res, cols, env, context=None): - for col, field in cols.items(): - res[col] = cols[col].get_description(env) - return res - def _group(self, items): """Return an XML chunk which represents a group of fields.""" names = [] From d3788534b482471e8c4aed6e75daa7544746b0fa Mon Sep 17 00:00:00 2001 From: Nicolas Bessi Date: Tue, 9 Sep 2014 14:21:55 +0200 Subject: [PATCH 05/10] Link server_environment_files_sample to server_environment_files in order to be able to install and run the tests --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7c6892808..930ac8872 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,7 +20,7 @@ install: - travis_install_nightly ${VERSION} - sudo pip install python-ldap - printf '[options]\n\nrunning_env = dev' > ${HOME}/.openerp_serverrc - + - ln -s server_environment_files_sample ./server_environment_files script: - travis_run_flake8 - travis_run_tests ${VERSION} From e4e5e8174e948586b231a7740bb6cdef6c223071 Mon Sep 17 00:00:00 2001 From: Nicolas Bessi Date: Tue, 9 Sep 2014 14:23:46 +0200 Subject: [PATCH 06/10] Fix typo in dir name --- .../__init__.py | 0 .../__openerp__.py | 0 .../default/base.conf | 0 .../default/mytopic.conf | 0 .../dev/base.conf | 0 .../dev/mytopic.conf | 0 .../i18n/server_environment_files.pot | 0 .../preprod/mytopic.conf | 0 .../prod/base.conf | 0 .../prod/mytopic.conf | 0 10 files changed, 0 insertions(+), 0 deletions(-) rename {server_environment_file_sample => server_environment_files_sample}/__init__.py (100%) rename {server_environment_file_sample => server_environment_files_sample}/__openerp__.py (100%) rename {server_environment_file_sample => server_environment_files_sample}/default/base.conf (100%) rename {server_environment_file_sample => server_environment_files_sample}/default/mytopic.conf (100%) rename {server_environment_file_sample => server_environment_files_sample}/dev/base.conf (100%) rename {server_environment_file_sample => server_environment_files_sample}/dev/mytopic.conf (100%) rename {server_environment_file_sample => server_environment_files_sample}/i18n/server_environment_files.pot (100%) rename {server_environment_file_sample => server_environment_files_sample}/preprod/mytopic.conf (100%) rename {server_environment_file_sample => server_environment_files_sample}/prod/base.conf (100%) rename {server_environment_file_sample => server_environment_files_sample}/prod/mytopic.conf (100%) diff --git a/server_environment_file_sample/__init__.py b/server_environment_files_sample/__init__.py similarity index 100% rename from server_environment_file_sample/__init__.py rename to server_environment_files_sample/__init__.py diff --git a/server_environment_file_sample/__openerp__.py b/server_environment_files_sample/__openerp__.py similarity index 100% rename from server_environment_file_sample/__openerp__.py rename to server_environment_files_sample/__openerp__.py diff --git a/server_environment_file_sample/default/base.conf b/server_environment_files_sample/default/base.conf similarity index 100% rename from server_environment_file_sample/default/base.conf rename to server_environment_files_sample/default/base.conf diff --git a/server_environment_file_sample/default/mytopic.conf b/server_environment_files_sample/default/mytopic.conf similarity index 100% rename from server_environment_file_sample/default/mytopic.conf rename to server_environment_files_sample/default/mytopic.conf diff --git a/server_environment_file_sample/dev/base.conf b/server_environment_files_sample/dev/base.conf similarity index 100% rename from server_environment_file_sample/dev/base.conf rename to server_environment_files_sample/dev/base.conf diff --git a/server_environment_file_sample/dev/mytopic.conf b/server_environment_files_sample/dev/mytopic.conf similarity index 100% rename from server_environment_file_sample/dev/mytopic.conf rename to server_environment_files_sample/dev/mytopic.conf diff --git a/server_environment_file_sample/i18n/server_environment_files.pot b/server_environment_files_sample/i18n/server_environment_files.pot similarity index 100% rename from server_environment_file_sample/i18n/server_environment_files.pot rename to server_environment_files_sample/i18n/server_environment_files.pot diff --git a/server_environment_file_sample/preprod/mytopic.conf b/server_environment_files_sample/preprod/mytopic.conf similarity index 100% rename from server_environment_file_sample/preprod/mytopic.conf rename to server_environment_files_sample/preprod/mytopic.conf diff --git a/server_environment_file_sample/prod/base.conf b/server_environment_files_sample/prod/base.conf similarity index 100% rename from server_environment_file_sample/prod/base.conf rename to server_environment_files_sample/prod/base.conf diff --git a/server_environment_file_sample/prod/mytopic.conf b/server_environment_files_sample/prod/mytopic.conf similarity index 100% rename from server_environment_file_sample/prod/mytopic.conf rename to server_environment_files_sample/prod/mytopic.conf From 269e2ca36f9d69591052175d91bad53150d32eb7 Mon Sep 17 00:00:00 2001 From: Nicolas Bessi Date: Tue, 9 Sep 2014 14:56:04 +0200 Subject: [PATCH 07/10] Refactor in order to support dotted parameters --- server_environment/serv_config.py | 18 ++++++++---------- server_environment/system_info.py | 2 +- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/server_environment/serv_config.py b/server_environment/serv_config.py index 472b4db07..0fd903897 100644 --- a/server_environment/serv_config.py +++ b/server_environment/serv_config.py @@ -133,15 +133,16 @@ class ServerConfiguration(models.TransientModel): def _add_columns(self): """Add columns to model dynamically""" cols = chain( - self._get_base_cols(), - self._get_env_cols(), - self._get_system_cols() + self._get_base_cols().items(), + self._get_env_cols().items(), + self._get_system_cols().items() ) - for col in cols: - print col + for col, value in cols: + col_name = col.replace('.', '_') setattr(ServerConfiguration, - col, + col_name, fields.Char(string=col, readonly=True)) + self._conf_defaults[col_name] = value def _get_base_cols(self): """ Compute base fields""" @@ -152,7 +153,6 @@ class ServerConfiguration(models.TransientModel): # fld.name = key # fld.model_name = self._model res[key] = item - self._conf_defaults[key] = item return res def _get_env_cols(self, sections=None): @@ -163,7 +163,6 @@ class ServerConfiguration(models.TransientModel): for col, item in serv_config.items(section): key = self._format_key(section, col) res[key] = item - self._conf_defaults[key] = item return res def _get_system_cols(self): @@ -172,7 +171,6 @@ class ServerConfiguration(models.TransientModel): for col, item in get_server_environment(): key = self._format_key('system', col) res[key] = item - self._conf_defaults[key] = item return res def _group(self, items): @@ -180,7 +178,7 @@ class ServerConfiguration(models.TransientModel): names = [] for key in sorted(items): - names.append(key) + names.append(key.replace('.', '_')) return ('' + ''.join(['' % _escape(name) for name in names]) + diff --git a/server_environment/system_info.py b/server_environment/system_info.py index bd0f5fea8..fd590eafc 100644 --- a/server_environment/system_info.py +++ b/server_environment/system_info.py @@ -53,7 +53,7 @@ def get_server_environment(): lsbinfo = 'not lsb compliant' return ( ('platform', platform.platform()), - ('os name', os.name), + ('os.name', os.name), ('lsb_release', lsbinfo), ('release', platform.release()), ('version', platform.version()), From fca8e9e7a9f9eb9a288905000a6ec790fc179589 Mon Sep 17 00:00:00 2001 From: Nicolas Bessi Date: Tue, 9 Sep 2014 15:41:55 +0200 Subject: [PATCH 08/10] Add unit test for server environment --- server_environment/tests/__init__.py | 22 +++++++++ .../tests/test_server_environment.py | 48 +++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 server_environment/tests/__init__.py create mode 100644 server_environment/tests/test_server_environment.py diff --git a/server_environment/tests/__init__.py b/server_environment/tests/__init__.py new file mode 100644 index 000000000..b712d6fb1 --- /dev/null +++ b/server_environment/tests/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author: Nicolas Bessi +# Copyright 2014 Camptocamp SA +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## +from . import test_server_environment +checks = [test_server_environment] diff --git a/server_environment/tests/test_server_environment.py b/server_environment/tests/test_server_environment.py new file mode 100644 index 000000000..a80d9f7b2 --- /dev/null +++ b/server_environment/tests/test_server_environment.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author: Nicolas Bessi +# Copyright 2014 Camptocamp SA +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## +from openerp.tests import common +from openerp.addons.server_environment import serv_config + + +class TestEnv(common.TransactionCase): + + def test_view(self): + model = self.env['server.config'] + view = model.fields_view_get() + self.assertTrue(view) + + def test_default(self): + model = self.env['server.config'] + rec = model.create({}) + defaults = rec.default_get([]) + self.assertTrue(defaults) + self.assertIsInstance(defaults, dict) + pass_checked = False + for default in defaults: + if 'passw' in default: + self.assertNotEqual(defaults[default], + '**********') + pass_checked = True + self.assertTrue(pass_checked) + + def test_value_retrival(self): + val = serv_config.get('external_service.ftp', 'user') + self.assertEqual(val, 'toto') From 2eb7e27ba83b733553de852f69b38db93b7e3d9f Mon Sep 17 00:00:00 2001 From: Nicolas Bessi Date: Tue, 9 Sep 2014 15:55:53 +0200 Subject: [PATCH 09/10] Improve performance by moving _build_osv in init --- server_environment/serv_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server_environment/serv_config.py b/server_environment/serv_config.py index 0fd903897..31ff51d75 100644 --- a/server_environment/serv_config.py +++ b/server_environment/serv_config.py @@ -126,6 +126,7 @@ class ServerConfiguration(models.TransientModel): # Only show passwords in development self.show_passwords = self.running_env in ('dev',) self._arch = None + self._build_osv() def _format_key(self, section, key): return '%s | %s' % (section, key) @@ -217,7 +218,6 @@ class ServerConfiguration(models.TransientModel): def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): """Overwrite the default method to render the custom view.""" - self._build_osv() res = super(ServerConfiguration, self).fields_view_get(cr, uid, view_id, view_type, From e6e7079e9d60ff5c4062fd0aab83ba5762f833c5 Mon Sep 17 00:00:00 2001 From: Nicolas Bessi Date: Wed, 10 Sep 2014 08:12:44 +0200 Subject: [PATCH 10/10] Remove dead commented code --- server_environment/serv_config.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/server_environment/serv_config.py b/server_environment/serv_config.py index 31ff51d75..74964d336 100644 --- a/server_environment/serv_config.py +++ b/server_environment/serv_config.py @@ -150,9 +150,6 @@ class ServerConfiguration(models.TransientModel): res = {} for col, item in system_base_config.options.items(): key = self._format_key('openerp', col) - # fld = fields.Char(string=col, readonly=True) - # fld.name = key - # fld.model_name = self._model res[key] = item return res