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
This commit is contained in:
Cédric Krier committed 2016-09-15 22:23:10 +02:00
1 parent ea0e436226
commit d4149a33b9
1 file changed
+3 -3
+3 -3
View File
@@ -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'