Browse Source

Merge pull request #766 from acsone/10.0-fix_web_advanced_search_x2x_domain-bwi

[FIX] Ensure that domain field can be evaluated before creating x2x field
pull/778/head
Pedro M. Baeza 7 years ago
committed by GitHub
parent
commit
2166640792
  1. 11
      web_advanced_search_x2x/static/src/js/web_advanced_search_x2x.js

11
web_advanced_search_x2x/static/src/js/web_advanced_search_x2x.js

@ -12,6 +12,7 @@ odoo.define('web_advanced_search_x2x.search_filters', function (require) {
var SearchView = require('web.SearchView'); var SearchView = require('web.SearchView');
var data = require('web.data'); var data = require('web.data');
var core = require('web.core'); var core = require('web.core');
var pyeval = require('web.pyeval');
var X2XAdvancedSearchPropositionMixin = { var X2XAdvancedSearchPropositionMixin = {
template: "web_advanced_search_x2x.proposition", template: "web_advanced_search_x2x.proposition",
@ -83,6 +84,16 @@ odoo.define('web_advanced_search_x2x.search_filters', function (require) {
} }
var widget = this.x2x_widget(); var widget = this.x2x_widget();
if (!widget) return; 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._x2x_field = new widget(
this, this,
this.x2x_field_create_options() this.x2x_field_create_options()

Loading…
Cancel
Save