summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/basic/basic_model.js
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2018-02-23 13:48:20 +0100
committerAaron Bohy <aab@odoo.com>2018-02-26 08:14:08 +0100
commita16013be6636db58a4252fafd67033c6643a1e48 (patch)
treefd6450966b2ca13fee73d202408a0baf6478e3a0 /addons/web/static/src/js/views/basic/basic_model.js
parent5b769650d6416be123e972aa8f4b2b2c25ce438f (diff)
[FIX] web: multi pages ordered o2m with onchange
Let's assume a one2many displayed over several pages with a default order such that a record, say R, that would normally be on page 1 is actually on another page. Moreover, there is an onchange on that one2many which converts all commands 4 (LINK_TO) into commands 1 (UPDATE), which is standard in the ORM. When the first line of the one2many was edited, the record R was fully loaded, whereas it shouldn't have been (as it is not on the current page). So basically, a useless read was performed. Moreover, if there was an x2many field in the one2many list, a crash occurred because relational data of R that shouldn't have been read wasn't postprocessed by the BasicModel. The useless read occurred because the one2many subrecords weren't correctly sorted before checking if some of them/some of their fields should be read. This is not the case anymore. OPW-1816800
Diffstat (limited to 'addons/web/static/src/js/views/basic/basic_model.js')
-rw-r--r--addons/web/static/src/js/views/basic/basic_model.js10
1 files changed, 5 insertions, 5 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 e2cc60f7fc4..18193a5c364 100644
--- a/addons/web/static/src/js/views/basic/basic_model.js
+++ b/addons/web/static/src/js/views/basic/basic_model.js
@@ -3804,14 +3804,14 @@ var BasicModel = AbstractModel.extend({
// for multi-pages list datapoints, we might need to read the
// order field first to apply the order on all pages
- if (list.res_ids.length > list.limit) {
- if (!list.orderedResIDs && list.orderedBy.length) {
+ if (list.res_ids.length > list.limit && list.orderedBy.length) {
+ if (!list.orderedResIDs) {
var fieldNames = _.pluck(list.orderedBy, 'name');
def = this._readMissingFields(list, _.filter(list.res_ids, _.isNumber), fieldNames);
- def.then(function () {
- self._sortList(list);
- });
}
+ def.then(function () {
+ self._sortList(list);
+ });
}
return def.then(function () {
var resIDs = [];