From faf7ec310d594c385c950a68332f120472f9fdee Mon Sep 17 00:00:00 2001 From: Roy Le Date: Sat, 26 Feb 2022 00:25:08 +0700 Subject: [PATCH] [FIX] disable_invalid_filters: can not be used in evaluation contexts --- openupgradelib/openupgrade.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/openupgradelib/openupgrade.py b/openupgradelib/openupgrade.py index c0a99b1c..f8b15a1b 100644 --- a/openupgradelib/openupgrade.py +++ b/openupgradelib/openupgrade.py @@ -2239,13 +2239,17 @@ def format_message(f): columns = ( getattr(model, '_columns', False) or getattr(model, '_fields') ) + + globaldict = {'uid': env.uid} + if version_info[0] < 14: + globaldict.update({'time': time}) # DOMAIN try: with savepoint(env.cr): # Strange artifact found in a filter domain = f.domain.replace('%%', '%') model.search( - safe_eval(domain, {'time': time, 'uid': env.uid}), + safe_eval(domain, globaldict), limit=1, ) except Exception: @@ -2256,7 +2260,7 @@ def format_message(f): continue # CONTEXT GROUP BY try: - context = safe_eval(f.context, {'time': time, 'uid': env.uid}) + context = safe_eval(f.context, globaldict) assert(isinstance(context, dict)) except Exception: logger.warning(