diff options
| author | Denis Roussel <denis.roussel@acsone.eu> | 2019-05-21 08:51:42 +0000 |
|---|---|---|
| committer | Martin Trigaux <mat@odoo.com> | 2019-05-23 09:04:22 +0000 |
| commit | c0577084478afc255d6ab4f3c8d35cb124ead67c (patch) | |
| tree | 2af723363c0de398bf743d9cee290467c7fea5a3 /addons/web/static/tests/fields/basic_fields_tests.js | |
| parent | 57bb236c24fb56b61a593bc9056cf9a5d722d46c (diff) | |
[FIX] base: support default boolean values in config_parameter
Commit a0dd81b added 'magic' support for ir.config_parameter
to res.config.settings fields.
However for boolean fields, we have:
IrConfigParameter.get_param(icp, field.default(self) if field.default else False)
if value is False we do nothing.
If icp is defined we get a str.
Now if field.default(self) is truthy, it will be called with value.lower().
In particular if value is the boolean True, it will crash and thus settings are
rendered inaccessible.
Note that commit odoo/enterprise@39fb3be0ef0 gave a default '' value to a
boolean field, sidestepping the issue.
By convention, config_parameters encode booleans using bool(str),
i.e. '' encodes False, while anything else encodes True.
We follow this convention here;
which means that "False" would be be interpreted as True (to Tarski's dismay).
Note that passing a default True value would mean that the config_parameter
would be False before the first settings save, which could be avoided by putting
the value in the module data.
opw-2000718
Closes odoo/odoo#33517
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Co-authored-by: Martin Trigaux <mat@odoo.com>
Diffstat (limited to 'addons/web/static/tests/fields/basic_fields_tests.js')
0 files changed, 0 insertions, 0 deletions
