Skip to content

Commit

Permalink
[IMP] disable_invalid_filters: log filter probes
Browse files Browse the repository at this point in the history
To have a hint on possible bottleneck issues for filters with heavy
queries. We can disable it setting the new `verbose` parameter to
`False`.
  • Loading branch information
chienandalu committed Jun 14, 2024
1 parent ca46fca commit fb69382
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion openupgradelib/openupgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit fb69382

Please sign in to comment.