diff --git a/trytond/model/model.py b/trytond/model/model.py index 0b7fe370a8..99a2f50850 100644 --- a/trytond/model/model.py +++ b/trytond/model/model.py @@ -2,7 +2,6 @@ # this repository contains the full copyright notices and license terms. import copy -import collections from functools import total_ordering from trytond.model import fields @@ -77,7 +76,7 @@ class Model(WarningErrorMixin, URLMixin, PoolBase, metaclass=ModelMeta): fields_names = list(cls._fields.keys()) for field_name in fields_names: default_method = getattr(cls, 'default_%s' % field_name, False) - if isinstance(default_method, collections.Callable): + if callable(default_method): cls._defaults[field_name] = default_method for k in cls._defaults: diff --git a/trytond/model/modelview.py b/trytond/model/modelview.py index 27a1cc031f..ffd7dfc1a6 100644 --- a/trytond/model/modelview.py +++ b/trytond/model/modelview.py @@ -170,8 +170,7 @@ class ModelView(Model): meth_done = set() while meth_names: meth_name = meth_names.pop() - assert isinstance( - getattr(cls, meth_name), collections.Callable), \ + assert callable(getattr(cls, meth_name)), \ "%s.%s not callable" % (cls, meth_name) setattr(field, attribute, getattr(field, attribute) | methods['depends'][meth_name])