summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views
diff options
context:
space:
mode:
authorLucas Perais (lpe) <lpe@odoo.com>2018-05-29 10:03:42 +0200
committerLucas Perais (lpe) <lpe@odoo.com>2018-05-29 13:44:23 +0200
commit94a7bef5db7e0f131d2cd5208d0ac1f78edce117 (patch)
treef6f1e5cb59e4ea3513550f9fba0516f56818b702 /addons/web/static/src/js/views
parent32821843c47ed19b515d5fcce43637a75699b38e (diff)
[FIX] web: domain evaluation in parented m2o in o2m list
Model A has a o2m to model B Model B has a m2o parent_id on B In A's form, add a B item, then in the m2o, create record Save and New Click on the m2o Before this commit, the python crashed on name_search. This was because we sent the virtual ids to it After this commit, there is no crash OPW 1850212 closes #24948
Diffstat (limited to 'addons/web/static/src/js/views')
-rw-r--r--addons/web/static/src/js/views/basic/basic_model.js9
1 files changed, 9 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 d276e66d33f..042f7bafa97 100644
--- a/addons/web/static/src/js/views/basic/basic_model.js
+++ b/addons/web/static/src/js/views/basic/basic_model.js
@@ -3129,6 +3129,15 @@ var BasicModel = AbstractModel.extend({
// when sent to the server, the x2manys values must be a list
// of commands in a context, but the list of ids in a domain
ids.toJSON = _generateX2ManyCommands.bind(null, fieldName);
+ } else if (field.type === 'one2many') { // Ids are evaluated as a list of ids
+ /* Filtering out virtual ids from the ids list
+ * The server will crash if there are virtual ids in there
+ * The webClient doesn't do literal id list comparison like ids == list
+ * Only relevant in o2m: m2m does create actual records in db
+ */
+ ids = _.filter(ids, function (id) {
+ return typeof id !== 'string';
+ });
}
context[fieldName] = ids;
}