[FIX] use native DOM methods to programmatically set focus on an element

jQuery breaks the expected ordering of triggered consequential events
to a focusing (a blur event on the source field, a focus event on the
destination one), which in turn breaks the expectations of the
auto-saving o2m, making the o2m field attempt to auto-save immediately
after having saved a row (via the [Return] key) e.g. create a new row
in a list o2m, press [Return], the widget creates a new empty row and
immediately tries to save it resulting — depending on the view's setup
— in either an empty row being saved or a bunch of fields being marked
as invalid even though the user hasn't done anything yet.

Bypass jquery to avoid this issue.

jQuery tracker ref: http://bugs.jquery.com/ticket/12094

bzr revid: xmo@openerp.com-20120717130251-q2cjoj6rkxh0bvdq
This commit is contained in:
Xavier Morel
2012-07-17 15:02:51 +02:00
parent 75c2845fb5
commit c3368bf2bb
+1 -1
View File
@@ -1916,7 +1916,7 @@ instance.web.form.AbstractField = instance.web.form.FormWidget.extend(instance.w
*/
delay_focus: function($elem) {
setTimeout(function() {
$elem.focus();
$elem[0].focus();
}, 50);
},
/**