[14.0][MIG] - migration server_environment
This commit is contained in:
parent
95a93e638d
commit
3122d6d3f4
|
|
@ -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/server_config.xml",
|
||||||
|
"security/res_groups.xml",
|
||||||
|
"serv_config.xml",
|
||||||
|
],
|
||||||
"installable": True,
|
"installable": True,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,11 @@ class ServerEnvTechNameMixin(models.AbstractModel):
|
||||||
_name = "server.env.techname.mixin"
|
_name = "server.env.techname.mixin"
|
||||||
_description = "Server environment technical name"
|
_description = "Server environment technical name"
|
||||||
_sql_constraints = [
|
_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
|
# TODO: could leverage the new option for computable / writable fields
|
||||||
# and get rid of some onchange / read / write code.
|
# and get rid of some onchange / read / write code.
|
||||||
|
|
|
||||||
|
|
@ -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>
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
<?xml version="1.0" ?>
|
<?xml version="1.0" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<act_window
|
<record model="ir.actions.act_window" id="act_show_config_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"
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,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
|
||||||
|
|
||||||
|
|
@ -306,10 +306,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 and 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
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,8 @@ from unittest.mock import patch
|
||||||
|
|
||||||
from odoo.tests import common
|
from odoo.tests import common
|
||||||
|
|
||||||
import odoo.addons.server_environment.models.server_env_mixin as server_env_mixin
|
from .. import server_env
|
||||||
from odoo.addons.server_environment import server_env
|
from ..models import server_env_mixin as server_env_mixin
|
||||||
|
|
||||||
|
|
||||||
class ServerEnvironmentCase(common.SavepointCase):
|
class ServerEnvironmentCase(common.SavepointCase):
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,7 @@ from unittest.mock import patch
|
||||||
|
|
||||||
from odoo.tools.config import config as odoo_config
|
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
|
from .common import ServerEnvironmentCase
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
../../../../server_environment
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
import setuptools
|
||||||
|
|
||||||
|
setuptools.setup(
|
||||||
|
setup_requires=['setuptools-odoo'],
|
||||||
|
odoo_addon=True,
|
||||||
|
)
|
||||||
Loading…
Reference in New Issue