summaryrefslogtreecommitdiff
path: root/odoo/fields.py
diff options
context:
space:
mode:
authorRaphael Collet <rco@odoo.com>2020-10-20 15:29:46 +0000
committerRaphael Collet <rco@odoo.com>2020-10-21 07:52:55 +0000
commit231bdca3f26d96f578503694e5aec062de2317ed (patch)
tree7ea32beadd5e2c66928bb72af3f2080cd4c050c3 /odoo/fields.py
parent3b1df8f57e0cd342fe7f9ff7bd34100b2c821569 (diff)
[FIX] core: validation of field parameters
The feature was actually not working as expected. It has been fixed, and a test now ensures it does work as expected. This commit also fixes some invalid parameters, hopefully nothing critical. closes odoo/odoo#60402 Related: odoo/enterprise#14273 Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Diffstat (limited to 'odoo/fields.py')
-rw-r--r--odoo/fields.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/odoo/fields.py b/odoo/fields.py
index 99d2ac9c8e4..dfdd203c490 100644
--- a/odoo/fields.py
+++ b/odoo/fields.py
@@ -356,8 +356,9 @@ class Field(MetaField('DummyField', (object,), {})):
def _setup_attrs(self, model, name):
""" Initialize the field parameter attributes. """
- # validate extra arguments
- for key in self.args:
+ attrs = self._get_attrs(model, name)
+ # validate arguments
+ for key in attrs:
# TODO: improve filter as there are attributes on the class which
# are not valid on the field, probably
if not (hasattr(self, key) or model._valid_field_parameter(self, key)):
@@ -368,8 +369,6 @@ class Field(MetaField('DummyField', (object,), {})):
" allow it",
model._name, name, key
)
-
- attrs = self._get_attrs(model, name)
self.__dict__.update(attrs)
# prefetch only stored, column, non-manual and non-deprecated fields