Add test for I18n schema fields when checking group visibility
authorThierry Florac <thierry.florac@onf.fr>
Tue, 20 Feb 2018 11:17:52 +0100
changeset 84 955e11fedace
parent 83 0bf5d2bc96df
child 85 8f3884da3f14
Add test for I18n schema fields when checking group visibility
src/pyams_form/group.py
--- a/src/pyams_form/group.py	Sat Jan 27 00:41:07 2018 +0100
+++ b/src/pyams_form/group.py	Tue Feb 20 11:17:52 2018 +0100
@@ -9,6 +9,7 @@
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE.
 #
+from pyams_i18n.interfaces.schema import II18nField
 
 __docformat__ = 'restructuredtext'
 
@@ -99,7 +100,12 @@
                     name = field.getName()
                     value = getattr(field.interface(context), name, None)
                     if value and (value != field.default):
-                        return True
+                        if II18nField.providedBy(field):
+                            for i18n_value in value.values():
+                                if i18n_value:
+                                    return True
+                        else:
+                            return True
             return False
 
     @property