summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2018-04-19 14:34:00 +0200
committerGéry Debongnie <ged@odoo.com>2018-04-19 17:15:26 +0200
commitb8bf945335f2e52dbd07f2560108f2ee4637598d (patch)
treed9c97128903f71411791ddeae6a607409b62e511 /addons/web/static/src/js
parent6c97aeee8de0ba495d48e659c9e50a5b4ca33d40 (diff)
[FIX] web: do not change pager when discarding changes
Here is a scenario that could happen before this commit: 1. go to a list view with more than one record, say 3 2. click on the 3rd record to open the form view 3. the pager says 3/3 4. click on edit button 5. click on discard button 6. the pager says 1/3 (but the record displayed is still the same) It is often necessary to restore the offset for the sub records, because the number of pages in a one2many could have changed. However, it is not a good idea to do that for the main record, since it interferes with the usual flow of operations.
Diffstat (limited to 'addons/web/static/src/js')
-rw-r--r--addons/web/static/src/js/views/basic/basic_model.js2
1 files changed, 2 insertions, 0 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 8fdcb305ddc..969e81576b1 100644
--- a/addons/web/static/src/js/views/basic/basic_model.js
+++ b/addons/web/static/src/js/views/basic/basic_model.js
@@ -347,6 +347,7 @@ var BasicModel = AbstractModel.extend({
var element = this.localData[id];
var isNew = this.isNew(id);
var rollback = 'rollback' in options ? options.rollback : isNew;
+ var initialOffset = element.offset;
this._visitChildren(element, function (elem) {
if (rollback && elem._savePoint) {
if (elem._savePoint instanceof Array) {
@@ -365,6 +366,7 @@ var BasicModel = AbstractModel.extend({
delete elem.tempLimitIncrement;
}
});
+ element.offset = initialOffset;
},
/**
* Duplicate a record (by calling the 'copy' route)