summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorSébastien Theys <seb@odoo.com>2018-10-12 14:29:51 +0000
committerSébastien Theys <seb@odoo.com>2018-10-12 14:29:51 +0000
commitc73efc27b72a0d3b6bbbd8d7d502d2a8e72bb68b (patch)
tree0776b5cad3341dbac1aa867b770629ad8da23b30 /addons/web/static/src
parent847ad7a44d65f1e965cda8acc9ffde92157c37d1 (diff)
[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
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/views/basic/basic_model.js8
1 files changed, 7 insertions, 1 deletions
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,