From 68547b4f476f2a1c020836111bbda913e856c7a9 Mon Sep 17 00:00:00 2001 From: Jean CAVALLO Date: Fri, 19 Apr 2013 15:50:28 +0200 Subject: [PATCH] Safer get_value for selection widget of Dict fields issue3165 review810002 --- .../gui/window/view_form/view/form_gtk/dictionary.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tryton/gui/window/view_form/view/form_gtk/dictionary.py b/tryton/gui/window/view_form/view/form_gtk/dictionary.py index 7bbd56b53b..d660ca29fb 100644 --- a/tryton/gui/window/view_form/view/form_gtk/dictionary.py +++ b/tryton/gui/window/view_form/view/form_gtk/dictionary.py @@ -111,7 +111,16 @@ class DictSelectionEntry(DictEntry): def get_value(self): text = self.widget.child.get_text() - return self._selection[text] + value = None + if text: + for txt, val in self._selection.items(): + if not val: + continue + if txt[:len(text)].lower() == text.lower(): + value = val + if len(txt) == len(text): + break + return value def set_value(self, value): values = dict(self.definition['selection'])