[FIX] web: new record on editable list

On an editable list view, an issue occurs with the following procedure:
- Click "Add an item", write something
- Press "Enter" key --> a new item is added, write something
- Click outside of the list, then click on the last item created
- Press "Enter" key --> the cursor is set at the beginning of the list

This is an issue for two reasons. First, the behavior is not the same if
we have clicked outside of the list before pressing "Enter", which is
not logical. Then, in some undetermined cases, the focus can be lost
then retrieved on the last record. It means that suddenly, the cursor
goes back at the beginning of the list without notice.

The latter issue is problematic when batch-encoding data, for example
encoding the lot numbers of incoming products thanks to a scanner.

opw-680758
This commit is contained in:
Nicolas Martinelli
2016-06-14 12:39:11 +02:00
parent 285deb9a14
commit e0c4ec54ca
@@ -630,7 +630,10 @@ ListView.include(/** @lends instance.web.ListView# */{
if (saveInfo.created) {
return self.start_edition();
}
var record = self.records[next_record](saveInfo.record, {wraparound: true});
var record = self.records[next_record](saveInfo.record);
if (record === undefined) {
return self.start_edition();
}
return self.start_edition(record, options);
});
},