From 67e36759ba4c7df4047da3446c587d7fae8b4d22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 10 Aug 2016 22:43:19 +0200 Subject: [PATCH] Manage None value in One2Many._set_value None could be a valid value when the read fails and a default None value is used instead. issue5729 review28611002 --- tryton/gui/window/view_form/model/field.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tryton/gui/window/view_form/model/field.py b/tryton/gui/window/view_form/model/field.py index d674a7874c..3601dac911 100644 --- a/tryton/gui/window/view_form/model/field.py +++ b/tryton/gui/window/view_form/model/field.py @@ -583,12 +583,14 @@ class O2MField(Field): def _set_value(self, record, value, default=False): self._set_default_value(record) group = record.value[self.name] - if not value or (len(value) and isinstance(value[0], (int, long))): + if not value: + return + if isinstance(value[0], (int, long)): mode = 'list ids' else: mode = 'list values' - if mode == 'list values' and len(value): + if mode == 'list values': context = self.context_get(record) field_names = set(f for v in value for f in v if f not in group.fields and '.' not in f)