From 3030f23fd7d43480d2c687d25b2d84d66e4f7848 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 1 Mar 2012 10:18:31 +0100 Subject: [PATCH] Return empty list when calling O2M.get if empty Test on required state except to have a value evaluated to False in case of empty O2M. issue2382 review258002 (transplanted from 9364d03b9467364498b3f0e97b0fd2e0e85dfa10) --- tryton/gui/window/view_form/model/field.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tryton/gui/window/view_form/model/field.py b/tryton/gui/window/view_form/model/field.py index 6d9f625581..e16dc76af6 100644 --- a/tryton/gui/window/view_form/model/field.py +++ b/tryton/gui/window/view_form/model/field.py @@ -511,6 +511,8 @@ class O2MField(CharField): get_readonly=readonly) values.pop(parent_name, None) result.append(('create', values)) + if not result[0][1]: + del result[0] if record_removed: result.append(('unlink', [x.id for x in record_removed])) if record_deleted: