From aefd6d2291bf2fa093af7b8796b7f73248d711f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 8 Jun 2014 00:21:53 +0200 Subject: [PATCH] Skip missing key of Dictionary field issue3944 review5361002 --- .../gui/window/view_form/view/form_gtk/dictionary.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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 27a039f597..87d1cce075 100644 --- a/tryton/gui/window/view_form/view/form_gtk/dictionary.py +++ b/tryton/gui/window/view_form/view/form_gtk/dictionary.py @@ -484,8 +484,13 @@ class DictWidget(WidgetInterface): key_ids = RPCExecute('model', self.schema_model, 'search', [('name', '=', key)], 0, CONFIG['client.limit'], None, context=context) - self.keys[key] = RPCExecute('model', self.schema_model, - 'get_keys', key_ids, context=context)[0] + if not key_ids: + return + keys = RPCExecute('model', self.schema_model, + 'get_keys', key_ids, context=context) + if not keys: + return + self.keys[key] = keys[0] except RPCException: pass @@ -506,6 +511,8 @@ class DictWidget(WidgetInterface): val = value[key] if key not in self.keys: self.add_key(key) + if key not in self.keys: + continue if key not in self.fields: self.add_line(key) widget = self.fields[key]