From 729aaa8a00f61167a91065d0e6e7446c5315fa0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 14 Feb 2014 00:04:31 +0100 Subject: [PATCH] Better guess "selection_change_with" attribute Testing on the instance for Selection field is not enough because some field selection could come from a Function field. So it is better to use a duck typing style in this case. issue3649 review3451002 --- trytond/model/model.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trytond/model/model.py b/trytond/model/model.py index 5b6de9dbbb..d7fabb339c 100644 --- a/trytond/model/model.py +++ b/trytond/model/model.py @@ -53,8 +53,8 @@ class Model(WarningErrorMixin, URLMixin, PoolBase): for attribute in ('on_change', 'on_change_with', 'autocomplete', 'selection_change_with'): if attribute == 'selection_change_with': - if (isinstance(field, fields.Selection) - and isinstance(field.selection, basestring)): + if isinstance( + getattr(field, 'selection', None), basestring): function_name = field.selection else: continue