[IMP] server_environmnet_ir_config_parameter: display in the config parameter list and form views the new field is_environment, and make the key and values readonly if checked

This commit is contained in:
Sylvain LE GAL 2020-10-16 11:32:23 +02:00 committed by Marcos Oitaben
parent b366a4bdcb
commit 0d5d0c30f5
12 changed files with 138 additions and 3 deletions

View File

@ -23,7 +23,7 @@ Server Environment Ir Config Parameter
:target: https://runbot.odoo-community.org/runbot/254/16.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
|badge1| |badge2| |badge3| |badge4| |badge5|
Override System Parameters from server environment file.
@ -91,6 +91,7 @@ Contributors
* Stéphane Bidoul <stephane.bidoul@acsone.eu> (https://acsone.eu)
* Thierry Ducrest <thierry.ducrest@camptocamp.com>
* Gilles Meyomesse <gilles.meyomesse@acsone.eu> (https://acsone.eu)
* Sylvain LE GAL (https://www.twitter.com/legalsylvain)
Other credits
~~~~~~~~~~~~~

View File

@ -10,4 +10,7 @@
"author": "ACSONE SA/NV, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/server-env",
"depends": ["server_environment"],
"data": [
"views/view_ir_config_parameter.xml",
],
}

View File

@ -19,6 +19,19 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: server_environment_ir_config_parameter
#: model:ir.model.fields,field_description:server_environment_ir_config_parameter.field_ir_config_parameter__is_environment
msgid "Defined by environment"
msgstr ""
#. module: server_environment_ir_config_parameter
#: model:ir.model.fields,help:server_environment_ir_config_parameter.field_ir_config_parameter__is_environment
msgid ""
"If check, the value in the database will be ignored and alternatively, the "
"system will use the key defined in your odoo.cfg environment file."
msgstr ""
#. module: server_environment_ir_config_parameter
#. odoo-python
#: code:addons/server_environment_ir_config_parameter/models/ir_config_parameter.py:0
#, python-format
msgid "Key %s is empty in server_environment_file"

View File

@ -19,6 +19,19 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: server_environment_ir_config_parameter
#: model:ir.model.fields,field_description:server_environment_ir_config_parameter.field_ir_config_parameter__is_environment
msgid "Defined by environment"
msgstr ""
#. module: server_environment_ir_config_parameter
#: model:ir.model.fields,help:server_environment_ir_config_parameter.field_ir_config_parameter__is_environment
msgid ""
"If check, the value in the database will be ignored and alternatively, the "
"system will use the key defined in your odoo.cfg environment file."
msgstr ""
#. module: server_environment_ir_config_parameter
#. odoo-python
#: code:addons/server_environment_ir_config_parameter/models/ir_config_parameter.py:0
#, python-format
msgid "Key %s is empty in server_environment_file"

View File

@ -19,6 +19,19 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: server_environment_ir_config_parameter
#: model:ir.model.fields,field_description:server_environment_ir_config_parameter.field_ir_config_parameter__is_environment
msgid "Defined by environment"
msgstr ""
#. module: server_environment_ir_config_parameter
#: model:ir.model.fields,help:server_environment_ir_config_parameter.field_ir_config_parameter__is_environment
msgid ""
"If check, the value in the database will be ignored and alternatively, the "
"system will use the key defined in your odoo.cfg environment file."
msgstr ""
#. module: server_environment_ir_config_parameter
#. odoo-python
#: code:addons/server_environment_ir_config_parameter/models/ir_config_parameter.py:0
#, python-format
msgid "Key %s is empty in server_environment_file"

View File

@ -20,6 +20,19 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: server_environment_ir_config_parameter
#: model:ir.model.fields,field_description:server_environment_ir_config_parameter.field_ir_config_parameter__is_environment
msgid "Defined by environment"
msgstr ""
#. module: server_environment_ir_config_parameter
#: model:ir.model.fields,help:server_environment_ir_config_parameter.field_ir_config_parameter__is_environment
msgid ""
"If check, the value in the database will be ignored and alternatively, the "
"system will use the key defined in your odoo.cfg environment file."
msgstr ""
#. module: server_environment_ir_config_parameter
#. odoo-python
#: code:addons/server_environment_ir_config_parameter/models/ir_config_parameter.py:0
#, python-format
msgid "Key %s is empty in server_environment_file"

View File

@ -20,6 +20,19 @@ msgstr ""
"2:1));\n"
#. module: server_environment_ir_config_parameter
#: model:ir.model.fields,field_description:server_environment_ir_config_parameter.field_ir_config_parameter__is_environment
msgid "Defined by environment"
msgstr ""
#. module: server_environment_ir_config_parameter
#: model:ir.model.fields,help:server_environment_ir_config_parameter.field_ir_config_parameter__is_environment
msgid ""
"If check, the value in the database will be ignored and alternatively, the "
"system will use the key defined in your odoo.cfg environment file."
msgstr ""
#. module: server_environment_ir_config_parameter
#. odoo-python
#: code:addons/server_environment_ir_config_parameter/models/ir_config_parameter.py:0
#, python-format
msgid "Key %s is empty in server_environment_file"

View File

@ -14,6 +14,19 @@ msgstr ""
"Plural-Forms: \n"
#. module: server_environment_ir_config_parameter
#: model:ir.model.fields,field_description:server_environment_ir_config_parameter.field_ir_config_parameter__is_environment
msgid "Defined by environment"
msgstr ""
#. module: server_environment_ir_config_parameter
#: model:ir.model.fields,help:server_environment_ir_config_parameter.field_ir_config_parameter__is_environment
msgid ""
"If check, the value in the database will be ignored and alternatively, the "
"system will use the key defined in your odoo.cfg environment file."
msgstr ""
#. module: server_environment_ir_config_parameter
#. odoo-python
#: code:addons/server_environment_ir_config_parameter/models/ir_config_parameter.py:0
#, python-format
msgid "Key %s is empty in server_environment_file"

View File

@ -1,10 +1,10 @@
# Copyright 2016-2018 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import _, api, models
from odoo import _, api, fields, models
from odoo.exceptions import UserError
from odoo.addons.server_environment import serv_config
from odoo.addons.server_environment.server_env import serv_config
SECTION = "ir.config_parameter"
@ -13,6 +13,18 @@ class IrConfigParameter(models.Model):
_inherit = "ir.config_parameter"
is_environment = fields.Boolean(
string="Defined by environment",
compute="_compute_is_environment",
help="If check, the value in the database will be ignored"
" and alternatively, the system will use the key defined"
" in your odoo.cfg environment file.",
)
def _compute_is_environment(self):
for parameter in self:
parameter.is_environment = serv_config.has_option(SECTION, parameter.key)
@api.model
def get_param(self, key, default=False):
value = super().get_param(key, default=None)

View File

@ -1,3 +1,4 @@
* Stéphane Bidoul <stephane.bidoul@acsone.eu> (https://acsone.eu)
* Thierry Ducrest <thierry.ducrest@camptocamp.com>
* Gilles Meyomesse <gilles.meyomesse@acsone.eu> (https://acsone.eu)
* Sylvain LE GAL (https://www.twitter.com/legalsylvain)

View File

@ -435,6 +435,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<li>Stéphane Bidoul &lt;<a class="reference external" href="mailto:stephane.bidoul&#64;acsone.eu">stephane.bidoul&#64;acsone.eu</a>&gt; (<a class="reference external" href="https://acsone.eu">https://acsone.eu</a>)</li>
<li>Thierry Ducrest &lt;<a class="reference external" href="mailto:thierry.ducrest&#64;camptocamp.com">thierry.ducrest&#64;camptocamp.com</a>&gt;</li>
<li>Gilles Meyomesse &lt;<a class="reference external" href="mailto:gilles.meyomesse&#64;acsone.eu">gilles.meyomesse&#64;acsone.eu</a>&gt; (<a class="reference external" href="https://acsone.eu">https://acsone.eu</a>)</li>
<li>Sylvain LE GAL (<a class="reference external" href="https://www.twitter.com/legalsylvain">https://www.twitter.com/legalsylvain</a>)</li>
</ul>
</div>
<div class="section" id="other-credits">

View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright (C) 2021 - Today: GRAP (http://www.grap.coop)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo>
<record id="view_ir_config_parameter_tree" model="ir.ui.view">
<field name="model">ir.config_parameter</field>
<field name="inherit_id" ref="base.view_ir_config_list" />
<field name="arch" type="xml">
<field name="value" position="after">
<field name="is_environment" />
</field>
</field>
</record>
<record id="view_ir_config_parameter_form" model="ir.ui.view">
<field name="model">ir.config_parameter</field>
<field name="inherit_id" ref="base.view_ir_config_form" />
<field name="arch" type="xml">
<field name="value" position="after">
<field name="is_environment" />
</field>
<field name="key" position="attributes">
<attribute
name="attrs"
>{'readonly': [('is_environment', '=', True)]}</attribute>
</field>
<field name="value" position="attributes">
<attribute
name="attrs"
>{'readonly': [('is_environment', '=', True)]}</attribute>
</field>
</field>
</record>
</odoo>