summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/basic
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2017-11-17 13:17:16 +0100
committerGéry Debongnie <ged@odoo.com>2017-11-20 11:05:46 +0100
commit6cd17d575c7d970286ec3dfedcfacf01be5f7592 (patch)
tree893f26b9be9a9e6ee7afabbe4d8f1f5cc968746c /addons/web/static/src/js/views/basic
parent5d1640edff14b465a1f83d9c09393738c48af882 (diff)
[FIX] web: properly refetch x2manys in some cases
Consider the following situation: a form view with a one2many which contains sub x2many fields (for example a m2m_tags). Suppose that the one2many has more than 40 records. Before this commit, trying to delete one of these records caused a crash. The reason is that when we delete a record, we need to reload the missing records in the one2many field. We actually do that with a _readUngroupedList. However, the _readUngroupedList method did not process x2many fields, so the information stored in the datapoints was 'raw', and the rest of the web client expected it to be a datapoint. To reproduce the issue in the testing environment, i had to use onchanges and a readonly attrs, to reach a situation where a crash could occur. This shows that, while the issue is critical, it was not totally trivial to be impacted by it.
Diffstat (limited to 'addons/web/static/src/js/views/basic')
-rw-r--r--addons/web/static/src/js/views/basic/basic_model.js4
1 files changed, 3 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 fcd9785b9a5..ed18be034af 100644
--- a/addons/web/static/src/js/views/basic/basic_model.js
+++ b/addons/web/static/src/js/views/basic/basic_model.js
@@ -1573,7 +1573,9 @@ var BasicModel = AbstractModel.extend({
return $.when.apply($, defs).then(function () {
// ensure to fetch up to 'limit' records (may be useful if records of
// the current page have been removed)
- return self._readUngroupedList(list);
+ return self._readUngroupedList(list).then(function () {
+ return self._fetchX2ManysBatched(list);
+ });
});
},
/**