From e0c4ec54caa9b4167d75927c7d166928e158eba8 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 14 Jun 2016 12:37:48 +0200 Subject: [PATCH] [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 --- addons/web/static/src/js/views/list_view_editable.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 32968d7e1f3..507d933508b 100644 --- a/addons/web/static/src/js/views/list_view_editable.js +++ b/addons/web/static/src/js/views/list_view_editable.js @@ -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); }); },