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

Affected files:
  M tryton/gui/window/view_form/view/form.py


Index: tryton/gui/window/view_form/view/form.py
===================================================================
--- a/tryton/gui/window/view_form/view/form.py
+++ b/tryton/gui/window/view_form/view/form.py
@@ -213,7 +213,11 @@
         record = self.screen.current_record
         if record:
             # Force to set fields in record
-            for field in record.group.fields:
+            # Get first the lazy one to reduce number of requests
+            fields = [(name, field.attrs.get('loading', 'eager'))
+                    for name, field in record.group.fields.iteritems()]
+            fields.sort(lambda x, y: cmp(y[1], x[1]))
+            for field, _ in fields:
                 record[field].get(record, check_load=False)
         for name, widgets in self.widgets.iteritems():
             field = None



-- 
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: pgp8idKNDvjYt.pgp
Description: PGP signature

Reply via email to