mirror of https://github.com/OCA/web.git
[FIX] web_advanced_search: `undefined` in x2m fields
Before this patch, when searching with the "equals to" operator in any x2many field, the searched parameter was always `undefined`. The problem was that the underlying field manager implementation was treating those fields as x2many, while the widget used was the `one2many` one. This patch simply mocks the underlying fake record to make think that any relational field is always a `one2many`. This sets all pieces in place and makes the field manager work as expected, and thus you can search as expected too.pull/1040/head
parent
0eb4a40552
commit
7cc961fb7b
|
@ -178,6 +178,10 @@ odoo.define("web_advanced_search", function (require) {
|
|||
};
|
||||
// See https://stackoverflow.com/a/11508530/1468388
|
||||
params.fields[this.field.name] = _.omit(this.field, "onChange");
|
||||
if (this.field.type.endsWith("2many")) {
|
||||
// X2many fields behave like m2o in the search context
|
||||
params.fields[this.field.name].type = "many2one";
|
||||
}
|
||||
params.fieldsInfo.default[this.field.name] = {};
|
||||
// Emulate `model.load()`, without RPC-calling `default_get()`
|
||||
this.datapoint_id = this.model._makeDataPoint(params).id;
|
||||
|
|
Loading…
Reference in New Issue