[MIG] server_environment: Migration to 14.0

This commit is contained in:
Mourad 2020-10-12 12:38:47 +02:00 committed by Maxime Franco
parent 1409364d3c
commit 7a2db778d7
6 changed files with 28 additions and 36 deletions

View File

@ -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
<models/server_env_mixin.py>`_.

View File

@ -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,
}

View File

@ -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
<models/server_env_mixin.py>`_.

View File

@ -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
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_server_config access_server_config model_server_config base.group_user 1 0 0 0
3 access_server_config_manager access_server_config_manger model_server_config base.group_system 1 1 1 1

View File

@ -1,15 +1,14 @@
<?xml version="1.0" ?>
<odoo>
<act_window
id="act_show_config_window"
name="Server Environment"
res_model="server.config"
view_mode="form"
/>
<record id="server_env_act_show_config" model="ir.actions.act_window">
<field name="name">Server Environment</field>
<field name="res_model">server.config</field>
<field name="view_mode">form</field>
</record>
<menuitem
parent="base.menu_ir_property"
sequence="90"
action="act_show_config_window"
action="server_env_act_show_config"
id="menu_server_show_config"
/>
</odoo>

View File

@ -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 <http://www.gnu.org/licenses/>.
#
##############################################################################
# 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