From c73efc27b72a0d3b6bbbd8d7d502d2a8e72bb68b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Theys?= Date: Fri, 12 Oct 2018 14:29:51 +0000 Subject: [FIX] web: stabilize sequence for new records on last page Before this commit, the compute sequence was relying on the fact the ID was used as a secondary order key to get the right result. This is necessary when adding items between pages because we don't resequence the following elements. However this was not necessary when adding new elements on the last page since there are no following elements to resesquence in that case. PR: #27639 --- addons/web/static/src/js/views/basic/basic_model.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'addons/web/static/src/js/views/basic/basic_model.js') diff --git a/addons/web/static/src/js/views/basic/basic_model.js b/addons/web/static/src/js/views/basic/basic_model.js index f6bf46aed68..0afb65a9a88 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -398,8 +398,14 @@ var BasicModel = AbstractModel.extend({ // by 1 (at least until there is a gap in the numbering). // We don't do it now because it's not an important case. + // However, we can for sure increment by 1 if we are on the last page. + var handleFieldValue = computedList.data[index].data[handleField]; - handleFieldValue = position !== 'top' ? handleFieldValue : handleFieldValue - 1; + if (position === 'top') { + handleFieldValue--; + } else if (list.count <= list.offset + list.limit - (list.tempLimitIncrement || 0)) { + handleFieldValue++; + } return { field: handleField, -- cgit v1.2.3