[14.0][MIG] - migration server_environment

This commit is contained in:
sbejaoui 2020-10-14 17:47:47 +02:00
parent 95a93e638d
commit 3122d6d3f4
9 changed files with 44 additions and 17 deletions

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/server_config.xml",
"security/res_groups.xml",
"serv_config.xml",
],
"installable": True,
}

View File

@ -29,7 +29,11 @@ class ServerEnvTechNameMixin(models.AbstractModel):
_name = "server.env.techname.mixin"
_description = "Server environment technical name"
_sql_constraints = [
("tech_name_uniq", "unique(tech_name)", "`tech_name` must be unique!",)
(
"tech_name_uniq",
"unique(tech_name)",
"`tech_name` must be unique!",
)
]
# TODO: could leverage the new option for computable / writable fields
# and get rid of some onchange / read / write code.

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2020 ACSONE SA/NV
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<record model="ir.model.access" id="server_config_access">
<field name="name">server.config access</field>
<field name="model_id" ref="model_server_config" />
<field name="group_id" ref="base.group_user" />
<field name="perm_read" eval="1" />
<field name="perm_create" eval="1" />
<field name="perm_write" eval="1" />
<field name="perm_unlink" eval="1" />
</record>
</odoo>

View File

@ -1,11 +1,10 @@
<?xml version="1.0" ?>
<odoo>
<act_window
id="act_show_config_window"
name="Server Environment"
res_model="server.config"
view_mode="form"
/>
<record model="ir.actions.act_window" id="act_show_config_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"

View File

@ -149,7 +149,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
@ -306,10 +306,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"]
if view_type == "form":
view = self.env["ir.ui.view"].browse(view_id)
if view and 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

View File

@ -7,8 +7,8 @@ from unittest.mock import patch
from odoo.tests import common
import odoo.addons.server_environment.models.server_env_mixin as server_env_mixin
from odoo.addons.server_environment import server_env
from .. import server_env
from ..models import server_env_mixin as server_env_mixin
class ServerEnvironmentCase(common.SavepointCase):

View File

@ -6,8 +6,7 @@ from unittest.mock import patch
from odoo.tools.config import config as odoo_config
from odoo.addons.server_environment import server_env
from .. import server_env
from .common import ServerEnvironmentCase

View File

@ -0,0 +1 @@
../../../../server_environment

View File

@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)