diff --git a/server_environment/README.rst b/server_environment/README.rst index 74065b9..2cac8a2 100644 --- a/server_environment/README.rst +++ b/server_environment/README.rst @@ -152,8 +152,8 @@ When the default field is used, the field is made editable on Odoo. Note: empty environment keys always take precedence over default fields -Keychain integration -~~~~~~~~~~~~~~~~~~~~ +Server environment integration +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Read the documentation of the class `models/server_env_mixin.py `_. diff --git a/server_environment/__manifest__.py b/server_environment/__manifest__.py index 7699d18..bbf204d 100644 --- a/server_environment/__manifest__.py +++ b/server_environment/__manifest__.py @@ -4,13 +4,17 @@ { "name": "server configuration environment files", - "version": "13.0.2.3.1", + "version": "14.0.1.0.0", "depends": ["base", "base_sparse_field"], "author": "Camptocamp,Odoo Community Association (OCA)", "summary": "move some configurations out of the database", "website": "http://github.com/OCA/server-env", "license": "GPL-3 or any later version", "category": "Tools", - "data": ["security/res_groups.xml", "serv_config.xml"], + "data": [ + "security/ir.model.access.csv", + "security/res_groups.xml", + "serv_config.xml", + ], "installable": True, } diff --git a/server_environment/readme/CONFIGURE.rst b/server_environment/readme/CONFIGURE.rst index 84b9ff9..b3e8024 100644 --- a/server_environment/readme/CONFIGURE.rst +++ b/server_environment/readme/CONFIGURE.rst @@ -92,8 +92,8 @@ When the default field is used, the field is made editable on Odoo. Note: empty environment keys always take precedence over default fields -Keychain integration -~~~~~~~~~~~~~~~~~~~~ +Server environment integration +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Read the documentation of the class `models/server_env_mixin.py `_. diff --git a/server_environment/security/ir.model.access.csv b/server_environment/security/ir.model.access.csv new file mode 100644 index 0000000..9940c85 --- /dev/null +++ b/server_environment/security/ir.model.access.csv @@ -0,0 +1,3 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_server_config,access_server_config,model_server_config,base.group_user,1,0,0,0 +access_server_config_manager,access_server_config_manger,model_server_config,base.group_system,1,1,1,1 diff --git a/server_environment/serv_config.xml b/server_environment/serv_config.xml index 29fab6d..5e66ec7 100644 --- a/server_environment/serv_config.xml +++ b/server_environment/serv_config.xml @@ -1,15 +1,14 @@ - + + Server Environment + server.config + form + diff --git a/server_environment/server_env.py b/server_environment/server_env.py index 3106f25..a0b265c 100644 --- a/server_environment/server_env.py +++ b/server_environment/server_env.py @@ -1,22 +1,8 @@ -############################################################################## -# -# Adapted by Nicolas Bessi. Copyright Camptocamp SA -# Based on Florent Xicluna original code. Copyright Wingo SA -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU 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 General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -############################################################################## +# Copyright 2020 Camptocamp (http://www.camptocamp.com) +# @author Nicolas Bessi +# Based on Florent Xicluna original code. Copyright Wingo SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + import configparser import logging @@ -149,7 +135,7 @@ def _load_config_from_env(config_p): def _load_config(): """Load the configuration and return a ConfigParser instance.""" - config_p = configparser.SafeConfigParser() + config_p = configparser.ConfigParser() # options are case-sensitive config_p.optionxform = str @@ -188,7 +174,7 @@ class ServerConfiguration(models.TransientModel): and init some properties """ - ModelClass = super(ServerConfiguration, cls)._build_model(pool, cr) + ModelClass = super()._build_model(pool, cr) ModelClass._add_columns() ModelClass._arch = None ModelClass._build_osv() @@ -306,10 +292,10 @@ class ServerConfiguration(models.TransientModel): ): """Overwrite the default method to render the custom view.""" res = super().fields_view_get(view_id, view_type, toolbar) - View = self.env["ir.ui.view"] + View = self.env["ir.ui.view"].browse(view_id) if view_type == "form": arch_node = self._arch - xarch, xfields = View.postprocess_and_fields(self._name, arch_node, view_id) + xarch, xfields = View.postprocess_and_fields(arch_node, model=self._name) res["arch"] = xarch res["fields"] = xfields return res