From 2a0607f1eb45cb9e00ec0f1f180f2acf0229bd35 Mon Sep 17 00:00:00 2001 From: Albert Cervera i Areny Date: Thu, 5 Oct 2017 22:33:14 +0200 Subject: [PATCH] Do not fail when completing selection with last value None This may happen when searching for several values which need to be quoted using ';"'. issue6714 review41511002 --- tryton/common/domain_parser.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tryton/common/domain_parser.py b/tryton/common/domain_parser.py index d664fa5fc0..0174cb52d1 100644 --- a/tryton/common/domain_parser.py +++ b/tryton/common/domain_parser.py @@ -687,7 +687,7 @@ def complete_value(field, value): def complete_selection(): test_value = value if value is not None else '' if isinstance(value, list): - test_value = value[-1] + test_value = value[-1] or '' test_value = test_value.strip('%') for svalue, test in field['selection']: if test.lower().startswith(test_value.lower()): @@ -743,6 +743,7 @@ def test_complete_selection(): ('', ['male', 'female']), (None, ['male', 'female']), (['male', 'f'], [['male', 'female']]), + (['male', None], [['male', 'male'], ['male', 'female']]), ): assert list(complete_value(field, value)) == result