[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>
This commit is contained in:
committed by
Martin Trigaux
parent
62c9227fda
commit
3dffce34bf
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user