[REVERT] revert web: Navigation improvement in editable list view"

This reverts commit c43a97f353.

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.
This commit is contained in:
Géry Debongnie
2016-06-03 10:24:38 +02:00
parent 83afe3b847
commit 0ce2583157
2 changed files with 2 additions and 2 deletions
@@ -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');
@@ -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;
});