From 58cef6005ab5e5864e0dd5e941ffd43c7553f7a8 Mon Sep 17 00:00:00 2001 From: DrZoidberg09 <96449693+DrZoidberg09@users.noreply.github.com> Date: Wed, 2 Nov 2022 08:41:20 +0100 Subject: [PATCH] fix: search.py after PR #17828 (#18719) * fix search.py After the PR #17828 in some cases an "IndexError: list assignment index out of range" error is thrown. This should fix it. * Update search.py Yes, that should be even better * style: formatting [skip ci] --- frappe/desk/search.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frappe/desk/search.py b/frappe/desk/search.py index c4a94074ba..190cbd99ae 100644 --- a/frappe/desk/search.py +++ b/frappe/desk/search.py @@ -284,7 +284,8 @@ def build_for_autosuggest(res: list[tuple], doctype: str) -> list[dict]: item = list(item) label = item[1] # use title as label item[1] = item[0] # show name in description instead of title - del item[2] # remove redundant title ("label") value + if len(item) >= 3: + del item[2] # remove redundant title ("label") value results.append({"value": item[0], "label": label, "description": to_string(item[1:])}) else: results.extend({"value": item[0], "description": to_string(item[1:])} for item in res)