mirror of https://github.com/OCA/web.git
[FIX] web_advanced_search: 2 fixes
* Ensure that domain field can be evaluated before creating x2x field * Fixed navigation error after using x2x advanced searchpull/1197/head
parent
04af761f2b
commit
0495d7ae8c
|
@ -5,7 +5,7 @@
|
|||
|
||||
{
|
||||
"name": "Search x2x fields",
|
||||
"version": "10.0.2.0.2",
|
||||
"version": "10.0.2.0.3",
|
||||
"author": "Therp BV, "
|
||||
"Tecnativa, "
|
||||
"Odoo Community Association (OCA)",
|
||||
|
|
|
@ -12,6 +12,7 @@ odoo.define('web_advanced_search_x2x.search_filters', function (require) {
|
|||
var SearchView = require('web.SearchView');
|
||||
var data = require('web.data');
|
||||
var core = require('web.core');
|
||||
var pyeval = require('web.pyeval');
|
||||
|
||||
var X2XAdvancedSearchPropositionMixin = {
|
||||
template: "web_advanced_search_x2x.proposition",
|
||||
|
@ -37,9 +38,11 @@ odoo.define('web_advanced_search_x2x.search_filters', function (require) {
|
|||
'value': 'domain', 'text': core._lt('is in selection'),
|
||||
});
|
||||
// Avoid hiding filter when using special widgets
|
||||
this.events["click"] = function (event) {
|
||||
event.stopPropagation();
|
||||
}
|
||||
this.events = $.extend({}, this.events, {
|
||||
click: function (event) {
|
||||
event.stopPropagation();
|
||||
},
|
||||
});
|
||||
return this._super.apply(this, arguments);
|
||||
},
|
||||
|
||||
|
@ -83,6 +86,16 @@ odoo.define('web_advanced_search_x2x.search_filters', function (require) {
|
|||
}
|
||||
var widget = this.x2x_widget();
|
||||
if (!widget) return;
|
||||
|
||||
var field_domain = this.field.domain;
|
||||
if (typeof field_domain === 'string') {
|
||||
try {
|
||||
pyeval.eval('domain', field_domain);
|
||||
} catch(e) {
|
||||
this.field.domain = "[]";
|
||||
}
|
||||
}
|
||||
|
||||
this._x2x_field = new widget(
|
||||
this,
|
||||
this.x2x_field_create_options()
|
||||
|
|
Loading…
Reference in New Issue