diff options
| author | mreficent <miquel.raich@eficent.com> | 2020-02-19 12:42:23 +0000 |
|---|---|---|
| committer | Martin Trigaux <mat@odoo.com> | 2020-02-20 14:58:33 +0000 |
| commit | 3dffce34bf80c2a8d8682ef986d6daafa5bb0b7f (patch) | |
| tree | 3ec174f7aa3d672d07635d4f54401ff3d7fa3725 /odoo/fields.py | |
| parent | 62c9227fdaac43329e48cd9446b40eee60dfeb1c (diff) | |
[IMP] fields: log warning for ignored selection
When a field is related, defining a selection or selection_add will
have no effect and the paramater is ignored.
Log a warning and fix all fields badly definied
Closes odoo/odoo#45716
closes odoo/odoo#45832
Related: odoo/enterprise#8613
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Diffstat (limited to 'odoo/fields.py')
| -rw-r--r-- | odoo/fields.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/odoo/fields.py b/odoo/fields.py index 3de87106fd5..64b8083df7c 100644 --- a/odoo/fields.py +++ b/odoo/fields.py @@ -2143,6 +2143,8 @@ class Selection(Field): # We cannot use field.selection or field.selection_add here # because those attributes are overridden by ``_setup_attrs``. if 'selection' in field.args: + if self.related: + _logger.warning("%s: selection attribute will be ignored as the field is related", self) selection = field.args['selection'] if isinstance(selection, list): if ( @@ -2156,6 +2158,8 @@ class Selection(Field): self.selection = selection if 'selection_add' in field.args: + if self.related: + _logger.warning("%s: selection_add attribute will be ignored as the field is related", self) selection_add = field.args['selection_add'] assert isinstance(selection_add, list), \ "%s: selection_add=%r must be a list" % (self, selection_add) |
