Please review this at http://codereview.appspot.com/3814043/

Affected files:
  M CHANGELOG
  M tryton/gui/window/view_form/model/record.py


Index: CHANGELOG
===================================================================
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,4 @@
+* Handle loading attribute on fields
 * Use default format for value in wizard form
 * Add One2One field

Index: tryton/gui/window/view_form/model/record.py
===================================================================
--- a/tryton/gui/window/view_form/model/record.py
+++ b/tryton/gui/window/view_form/model/record.py
@@ -74,7 +74,14 @@
     def __getitem__(self, name):
         if name not in self._loaded and self.id > 0:
             ids =  [self.id]
-            if self in self.group:
+            if name == '*':
+                loading = reduce(
+                        lambda x, y: x == y == 'eager' and 'eager' or
'lazy',
+                        (field.attrs.get('loading', 'eager')
+                            for field in self.group.fields.itervalues()))
+            else:
+                loading =
self.group.fields[name].attrs.get('loading', 'eager')
+            if self in self.group and loading == 'eager':
                 idx = self.group.index(self)
                 length = len(self.group)
                 n = 1



-- 
Cédric Krier

B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59
Email/Jabber: [email protected]
Website: http://www.b2ck.com/

Attachment: pgpAyhPhPqJiN.pgp
Description: PGP signature

Reply via email to