[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 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 Read the documentation of the class `models/server_env_mixin.py
<models/server_env_mixin.py>`_. <models/server_env_mixin.py>`_.

View File

@ -4,13 +4,17 @@
{ {
"name": "server configuration environment files", "name": "server configuration environment files",
"version": "13.0.2.3.1", "version": "14.0.1.0.0",
"depends": ["base", "base_sparse_field"], "depends": ["base", "base_sparse_field"],
"author": "Camptocamp,Odoo Community Association (OCA)", "author": "Camptocamp,Odoo Community Association (OCA)",
"summary": "move some configurations out of the database", "summary": "move some configurations out of the database",
"website": "http://github.com/OCA/server-env", "website": "http://github.com/OCA/server-env",
"license": "GPL-3 or any later version", "license": "GPL-3 or any later version",
"category": "Tools", "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, "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 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 Read the documentation of the class `models/server_env_mixin.py
<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" ?> <?xml version="1.0" ?>
<odoo> <odoo>
<act_window <record id="server_env_act_show_config" model="ir.actions.act_window">
id="act_show_config_window" <field name="name">Server Environment</field>
name="Server Environment" <field name="res_model">server.config</field>
res_model="server.config" <field name="view_mode">form</field>
view_mode="form" </record>
/>
<menuitem <menuitem
parent="base.menu_ir_property" parent="base.menu_ir_property"
sequence="90" sequence="90"
action="act_show_config_window" action="server_env_act_show_config"
id="menu_server_show_config" id="menu_server_show_config"
/> />
</odoo> </odoo>

View File

@ -1,22 +1,8 @@
############################################################################## # Copyright 2020 Camptocamp (http://www.camptocamp.com)
# # @author Nicolas Bessi
# Adapted by Nicolas Bessi. Copyright Camptocamp SA # Based on Florent Xicluna original code. Copyright Wingo SA
# Based on Florent Xicluna original code. Copyright Wingo SA # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
#
# 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/>.
#
##############################################################################
import configparser import configparser
import logging import logging
@ -149,7 +135,7 @@ def _load_config_from_env(config_p):
def _load_config(): def _load_config():
"""Load the configuration and return a ConfigParser instance.""" """Load the configuration and return a ConfigParser instance."""
config_p = configparser.SafeConfigParser() config_p = configparser.ConfigParser()
# options are case-sensitive # options are case-sensitive
config_p.optionxform = str config_p.optionxform = str
@ -188,7 +174,7 @@ class ServerConfiguration(models.TransientModel):
and init some properties and init some properties
""" """
ModelClass = super(ServerConfiguration, cls)._build_model(pool, cr) ModelClass = super()._build_model(pool, cr)
ModelClass._add_columns() ModelClass._add_columns()
ModelClass._arch = None ModelClass._arch = None
ModelClass._build_osv() ModelClass._build_osv()
@ -306,10 +292,10 @@ class ServerConfiguration(models.TransientModel):
): ):
"""Overwrite the default method to render the custom view.""" """Overwrite the default method to render the custom view."""
res = super().fields_view_get(view_id, view_type, toolbar) 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": if view_type == "form":
arch_node = self._arch 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["arch"] = xarch
res["fields"] = xfields res["fields"] = xfields
return res return res