From c3368bf2bbd779b1dd9e2bbc202cf85845803030 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 17 Jul 2012 15:02:51 +0200 Subject: [FIX] use native DOM methods to programmatically set focus on an element MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- addons/web/static/src/js/view_form.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index b090c1c18ec..98d50546c52 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -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); }, /** -- cgit v1.2.3