From 84b0c7ebbf3cc7770cd90a1519d47b4f6e531f58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 17 Mar 2010 17:54:16 +0100 Subject: [PATCH] Allow to have boolean as states value --- trytond/model/fields/field.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/trytond/model/fields/field.py b/trytond/model/fields/field.py index 556671be36..4c40b339f8 100644 --- a/trytond/model/fields/field.py +++ b/trytond/model/fields/field.py @@ -28,10 +28,11 @@ def states_validate(value): for state in value: if state == 'icon': continue - assert isinstance(value[state], PYSON), \ + assert isinstance(value[state], (bool, PYSON)), \ 'values of states must be PYSON' - assert value[state].types() == set([bool]), \ - 'values of states must return boolean' + if hasattr(value[state], 'types'): + assert value[state].types() == set([bool]), \ + 'values of states must return boolean' def on_change_validate(value): if value: