diff options
| author | Géry Debongnie <ged@odoo.com> | 2016-06-03 10:24:38 +0200 |
|---|---|---|
| committer | Géry Debongnie <ged@odoo.com> | 2016-06-03 10:24:38 +0200 |
| commit | 0ce25831575d2da3ce37f3343a1c3f0d5bc71a3e (patch) | |
| tree | 0ea33ec5dbeb13ed770b5dd1ef753203fd0bf7c8 /addons/web/static/src/js/views | |
| parent | 83afe3b847c7cd2ba37d69c7894d438d1259b0b8 (diff) | |
[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.
Diffstat (limited to 'addons/web/static/src/js/views')
| -rw-r--r-- | addons/web/static/src/js/views/form_relational_widgets.js | 2 | ||||
| -rw-r--r-- | 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; }); |
