From fb6938222964e54d7ae76db84779fb2494eadcff Mon Sep 17 00:00:00 2001 From: David Date: Fri, 14 Jun 2024 12:10:53 +0200 Subject: [PATCH] [IMP] disable_invalid_filters: log filter probes To have a hint on possible bottleneck issues for filters with heavy queries. We can disable it setting the new `verbose` parameter to `False`. --- openupgradelib/openupgrade.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/openupgradelib/openupgrade.py b/openupgradelib/openupgrade.py index 4c173de0e24..89d4cdfe2f1 100644 --- a/openupgradelib/openupgrade.py +++ b/openupgradelib/openupgrade.py @@ -2743,7 +2743,7 @@ def delete_record_translations(cr, module, xml_ids, field_list=None): # flake8: noqa: C901 -def disable_invalid_filters(env): +def disable_invalid_filters(env, verbose=True): """It analyzes all the existing active filters to check if they are still correct. If not, they are disabled for avoiding errors when clicking on them, or worse, if they are default filters when opening the model/action. @@ -2785,6 +2785,13 @@ def format_message(f): if f.model_id not in env: continue # Obsolete or invalid model model = env[f.model_id] + if verbose: + logger.info( + "Checking filter '%s' on model %s with domain %s", + f.name, + model._name, + f.domain, + ) try: columns = model._fields except AttributeError: