summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views
diff options
context:
space:
mode:
authorPriyanka Kakadiya <pka@odoo.com>2019-04-10 09:44:41 +0000
committerAaron Bohy <aab@odoo.com>2019-04-24 07:07:41 +0000
commit8bcb17b67415e4e28fbb1fc6b5feae767f0b8b1e (patch)
tree429a262af307c4e26c149fddc9f3b719365a3bb5 /addons/web/static/src/js/views
parent11b24c6b45893a8802054a3351a20f8b834f0043 (diff)
[FIX] web: grouped Kanban: traceback on click during reload
Have a grouped Kanban view with an x2many field. Interact with the searchview, and then click anywhere. The fetch of the x2many relational data is batched for the whole view a single RPC for all groups) since e10fd346. If the click occurs before all search_read are done (i.e. before the fetch of relational data is started), there is a crash. This is due to a call to get({raw: true}) to obtain the current model's state, which is currently being reloaded and in an intermediate state. Ideally, this shouldn't happen, but with the sync API of get, we can't change that easily. So at most, we can ensure that it doesn't crash. Moreover, sensitive functions requesting the state for the data can do that in the mutex to ensure that the state isn't currently being reloaded. Related to Issue: 1937149 closes odoo/odoo#32587 Signed-off-by: Géry Debongnie (ged) <ged@openerp.com> Co-authored-by: Mohammed Shekha <msh@openerp.com> Co-authored-by: Aaron Bohy <aab@odoo.com>
Diffstat (limited to 'addons/web/static/src/js/views')
-rw-r--r--addons/web/static/src/js/views/basic/basic_model.js13
1 files changed, 10 insertions, 3 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 0314eed5a2f..95003e2226f 100644
--- a/addons/web/static/src/js/views/basic/basic_model.js
+++ b/addons/web/static/src/js/views/basic/basic_model.js
@@ -563,9 +563,16 @@ var BasicModel = AbstractModel.extend({
}
} else if (field.type === 'one2many' || field.type === 'many2many') {
if (options.raw) {
- relDataPoint = this.localData[data[fieldName]];
- relDataPoint = this._applyX2ManyOperations(relDataPoint);
- data[fieldName] = relDataPoint.res_ids;
+ if (typeof data[fieldName] === 'string') {
+ relDataPoint = this.localData[data[fieldName]];
+ relDataPoint = this._applyX2ManyOperations(relDataPoint);
+ data[fieldName] = relDataPoint.res_ids;
+ } else {
+ // no datapoint has been created yet (because the loading of relational
+ // data has been batched, and hasn't started yet), so the value is still
+ // the list of ids in the relation
+ data[fieldName] = data[fieldName] || [];
+ }
} else {
data[fieldName] = this.get(data[fieldName]) || [];
}