Skip to content

Commit d1c83e4

Browse files
committed
[FIX] fields: Handle invalid domains
Some filters are simply invalid, and leads to a traceback when removing fields in them.
1 parent d97d115 commit d1c83e4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/util/fields.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,11 @@ def clean_context(context):
145145
[model, r"\y{}\y".format(fieldname)],
146146
)
147147
for id_, name, context_s in cr.fetchall():
148-
context = safe_eval(context_s or "{}", SelfPrintEvalContext(), nocopy=True)
148+
try:
149+
context = safe_eval(context_s or "{}", SelfPrintEvalContext(), nocopy=True)
150+
except SyntaxError:
151+
_logger.warning("Invalid filter syntax %s: %s", id_, name)
152+
continue
149153
changed = clean_context(context)
150154
cr.execute("UPDATE ir_filters SET context = %s WHERE id = %s", [unicode(context), id_])
151155
if changed:

0 commit comments

Comments
 (0)