From d4149a33b97b36b3fc4b2205d538ddde7094a417 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 15 Sep 2016 22:23:10 +0200 Subject: [PATCH] Empty value in O2M should remove existing record The changeset b05bedef260a wrongly skip the removal of existing record in the group. So it was not possible to remove the last record of the field. issue5878 review31521002 --- tryton/gui/window/view_form/model/field.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tryton/gui/window/view_form/model/field.py b/tryton/gui/window/view_form/model/field.py index 3601dac911..8b6ff1838c 100644 --- a/tryton/gui/window/view_form/model/field.py +++ b/tryton/gui/window/view_form/model/field.py @@ -583,9 +583,9 @@ class O2MField(Field): def _set_value(self, record, value, default=False): self._set_default_value(record) group = record.value[self.name] - if not value: - return - if isinstance(value[0], (int, long)): + if value is None: + value = [] + if not value or isinstance(value[0], (int, long)): mode = 'list ids' else: mode = 'list values'