From d1c83e449e053ee2e1e7109926b64b785c31e85f Mon Sep 17 00:00:00 2001 From: Nicolas Seinlet Date: Thu, 16 Nov 2023 09:26:19 +0100 Subject: [PATCH] [FIX] fields: Handle invalid domains Some filters are simply invalid, and leads to a traceback when removing fields in them. --- src/util/fields.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/util/fields.py b/src/util/fields.py index 2c8d6013d..b5b681141 100644 --- a/src/util/fields.py +++ b/src/util/fields.py @@ -145,7 +145,11 @@ def clean_context(context): [model, r"\y{}\y".format(fieldname)], ) for id_, name, context_s in cr.fetchall(): - context = safe_eval(context_s or "{}", SelfPrintEvalContext(), nocopy=True) + try: + context = safe_eval(context_s or "{}", SelfPrintEvalContext(), nocopy=True) + except SyntaxError: + _logger.warning("Invalid filter syntax %s: %s", id_, name) + continue changed = clean_context(context) cr.execute("UPDATE ir_filters SET context = %s WHERE id = %s", [unicode(context), id_]) if changed: