Skip to content

Commit 717cd3f

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 f1f3ca2 commit 717cd3f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/util/fields.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,12 @@ def clean_context(context):
147147
[model, r"\y{}\y".format(fieldname)],
148148
)
149149
for id_, name, context_s in cr.fetchall():
150-
context = safe_eval(context_s or "{}", SelfPrintEvalContext(), nocopy=True)
150+
try:
151+
context = safe_eval(context_s or "{}", SelfPrintEvalContext(), nocopy=True)
152+
except SyntaxError:
153+
cr.execute("DELETE FROM ir_filters WHERE id = %s", [id_])
154+
add_to_migration_reports(("ir.filters", id_, name), "Filters/Dashboards")
155+
continue
151156
changed = clean_context(context)
152157
cr.execute("UPDATE ir_filters SET context = %s WHERE id = %s", [unicode(context), id_])
153158
if changed:

0 commit comments

Comments
 (0)