Skip to content

Commit cae04ba

Browse files
committed
[IMP] fields: add warning for field attributes select and digits_compute
1 parent 9a75c6d commit cae04ba

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

odoo/fields.py

+8
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
DATETIME_LENGTH = len(datetime.now().strftime(DATETIME_FORMAT))
2727
EMPTY_DICT = frozendict()
2828

29+
RENAMED_ATTRS = [('select', 'index'), ('digits_compute', 'digits')]
30+
2931
_logger = logging.getLogger(__name__)
3032
_schema = logging.getLogger(__name__[:-7] + '.schema')
3133

@@ -453,6 +455,12 @@ def _setup_attrs(self, model, name):
453455
if not attrs.get('readonly'):
454456
attrs['inverse'] = self._inverse_sparse
455457

458+
# check for renamed attributes (conversion errors)
459+
for key1, key2 in RENAMED_ATTRS:
460+
if key1 in attrs:
461+
_logger.warning("Field %s: parameter %r is no longer supported; use %r instead.",
462+
self, key1, key2)
463+
456464
self.set_all_attrs(attrs)
457465

458466
# prefetch only stored, column, non-manual and non-deprecated fields

0 commit comments

Comments
 (0)