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 f6e048f
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 @@ -2814,6 +2814,13 @@ def format_message(f):
with savepoint(env.cr):
# Strange artifact found in a filter
domain = f.domain.replace("%%", "%")
if verbose:
logger.info(
"Probing filter '%s' on model %s with domain %s",
f.name,
model._name,
domain,
)
model.search(
safe_eval(domain, globaldict),
limit=1,
Expand Down

0 comments on commit f6e048f

Please sign in to comment.