Chirag Patel (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-client-web/6.0-opw-18466_2-cpa into 
lp:openobject-client-web.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-client-web/6.0-opw-18466_2-cpa/+merge/86785

Hello,

default_focus is not works for all type of input field only works for m2o and 
button.

Demo:
1) Set default_focus = "1" in any type of field in formview.

Observed : In form can't set focus of field except m2o and button.
Expected : It's also work with char, float, date...

Thanks.
-- 
https://code.launchpad.net/~openerp-dev/openobject-client-web/6.0-opw-18466_2-cpa/+merge/86785
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-client-web/6.0-opw-18466_2-cpa.
=== modified file 'addons/openerp/controllers/templates/form.mako'
--- addons/openerp/controllers/templates/form.mako	2011-01-21 09:36:34 +0000
+++ addons/openerp/controllers/templates/form.mako	2011-12-23 09:07:57 +0000
@@ -25,6 +25,7 @@
             /*
             % endif
             */
+            jQuery('[autofocus="autofocus"]').focus();
         });
     </script>
 

=== modified file 'addons/openerp/widgets/_interface.py'
--- addons/openerp/widgets/_interface.py	2011-01-17 11:57:11 +0000
+++ addons/openerp/widgets/_interface.py	2011-12-23 09:07:57 +0000
@@ -167,6 +167,7 @@
         self.callback = attrs.get('on_change', None)
         self.kind = attrs.get('type', None)
 
+        self.default_focus = attrs.get('default_focus', False)
         self.label = self.label_type(self.name, self.string, self.help)
         self.filters = []
 
@@ -218,7 +219,8 @@
                 'callback': self.callback or None,
                 'onchange': self.onchange
             })
-
+        if self.default_focus:
+            params['attrs']['autofocus'] = 'autofocus'
         if self.readonly:
             params['attrs']['disabled'] = 'disabled'
 

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to