From 673b784f868f96eaa27b09a784824cac039561ff Mon Sep 17 00:00:00 2001 From: Victor Feyens Date: Tue, 27 Sep 2022 17:05:51 +0000 Subject: [PATCH] [FIX] web: magic commands in search domain Before this commit, when we used a domain on many to many relational fields, the `dataContext()` returned the context of the field, which contained a command tuple. This causes an error server side, when a domain [('id', 'in', [[6, False, [3,4]]])] is provided to search available records to fill the x2m field. Now, it returns the `currentIds`, which correctly gives the id(s) of the records. Approved by SAD X-original-commit: 5653e23a333262683257575d071575a63981ca33 Part-of: odoo/odoo#101352 Co-authored-by: Valentin Chevalier --- addons/web/static/src/views/relational_model.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/views/relational_model.js b/addons/web/static/src/views/relational_model.js index 6e4f88df132..d0cb38c4bfa 100644 --- a/addons/web/static/src/views/relational_model.js +++ b/addons/web/static/src/views/relational_model.js @@ -446,7 +446,7 @@ export class Record extends DataPoint { evalContext[fieldName] = false; } else if (isX2Many(this.fields[fieldName])) { const list = this._cache[fieldName]; - evalContext[fieldName] = list.getContext(); + evalContext[fieldName] = list.currentIds; // ---> implied to initialize (resIds, commands) currentIds before loading static list } else if (value && this.fields[fieldName].type === "date") { evalContext[fieldName] = serializeDate(value);