[FIX] openerp: fix traceback when no field in constrains
In case you don't have 'field', the first 'if' will raise a warning. In this case the second 'if' will crash with: "'NoneType' object has no attribute 'store'" This commit closes #16146 Courtesy of @kmetaxas
This commit is contained in:
parent
7f260ab517
commit
d7c765f62f
|
@ -750,7 +750,7 @@ class BaseModel(object):
|
|||
field = cls._fields.get(name)
|
||||
if not field:
|
||||
_logger.warning("method %s.%s: @constrains parameter %r is not a field name", cls._name, attr, name)
|
||||
if not (field.store or field.column and field.column._fnct_inv):
|
||||
elif not (field.store or field.column and field.column._fnct_inv):
|
||||
_logger.warning("method %s.%s: @constrains parameter %r is not writeable", cls._name, attr, name)
|
||||
methods.append(func)
|
||||
|
||||
|
|
Loading…
Reference in New Issue