From 0ce25831575d2da3ce37f3343a1c3f0d5bc71a3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Fri, 3 Jun 2016 10:24:38 +0200 Subject: [PATCH] [REVERT] revert web: Navigation improvement in editable list view" This reverts commit c43a97f353b76e211cad939a1c02c06e8ee724b7. If you use a setTimeout in your js code, you might want to have a serious look at what you are doing. You are almost certainly doing it wrong. If you chain a deferred with the number returned from a setTimeout, you definitely don't know what you are doing. If you try to fix editable list view by magically adding timeout, potentially inversing the order of execution, and without understanding how deferred works, it is clear that you are just changing stuff until your particular bug disappear in your particular case, and that you have no idea what other bugs you just introduced. Please study how deferred works, how the basic JS methods works, learn what setTimeout returns. Also, you might want to have a basic understanding of how and when expressions are evaluated. For example, if you cannot explain why a if statement cannot be replaced by a function, you might want to stop what you are doing and educate yourself. --- addons/web/static/src/js/views/form_relational_widgets.js | 2 +- addons/web/static/src/js/views/list_view_editable.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/js/views/form_relational_widgets.js b/addons/web/static/src/js/views/form_relational_widgets.js index a471d0fd3a5..d4c67db5218 100644 --- a/addons/web/static/src/js/views/form_relational_widgets.js +++ b/addons/web/static/src/js/views/form_relational_widgets.js @@ -1022,7 +1022,7 @@ var X2ManyList = ListView.List.extend({ } def = self.view.save_edition(); } - $.when(def).done(setTimeout(self.view.do_add_record.bind(self), 100)); + $.when(def).done(self.view.do_add_record.bind(self)); })); var $padding = this.$current.find('tr:not([data-id]):first'); diff --git a/addons/web/static/src/js/views/list_view_editable.js b/addons/web/static/src/js/views/list_view_editable.js index 3dde29e25a2..02f810e5c66 100644 --- a/addons/web/static/src/js/views/list_view_editable.js +++ b/addons/web/static/src/js/views/list_view_editable.js @@ -379,7 +379,7 @@ ListView.include(/** @lends instance.web.ListView# */{ }); } if (fields[focus_field]) { - fields[focus_field].$el.find('input, textarea').andSelf().filter('input, textarea').select(); + fields[focus_field].$el.find('input, textarea').andSelf().filter('input, textarea').focus(); } return record.attributes; });