msgs = []
for rec in self:
if len(rec.name_search_ids) > 4:
msgs.append(
"You have selected more than 4 fields for smart search, "
"fewerer fields is recommended"
)
if any(x.translate for x in rec.name_search_ids):
msgs.append(
"You have selected translatable fields in the smart search,"
" try to avoid them if possible"
)
# rec.smart_search_warning = msg
if msgs:
rec.smart_search_warning = (
"<p>In case of performance issues we recommend to review "
"these suggestions: <ul>%s</ul></p>"
) % "".join(["<li>%s</li>" % x for x in msgs])
else:
rec.smart_search_warning = False
|