From 3c452a2ecd73c1f6d739fd4d8db1f5f6313fd752 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Thu, 19 Jan 2017 15:06:29 +0100 Subject: [FIX] web: document domain selector options correctly The "ModelFieldSelector" widget has a "filters" option which can customize the fields which are displayed. The "DomainSelector" widget has of course the same option it can transmit to its internal "ModelFieldSelector" instance... but it was documented as "fs_filters" instead of "filters". Also, let the "ModelFieldSelector" document its own options and sets their defaults (instead of the "DomainSelector" widget). --- addons/web/static/src/js/widgets/model_field_selector.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'addons/web/static/src/js/widgets/model_field_selector.js') diff --git a/addons/web/static/src/js/widgets/model_field_selector.js b/addons/web/static/src/js/widgets/model_field_selector.js index 109b7ead7df..35c9e00d077 100644 --- a/addons/web/static/src/js/widgets/model_field_selector.js +++ b/addons/web/static/src/js/widgets/model_field_selector.js @@ -119,8 +119,9 @@ var ModelFieldSelector = Widget.extend({ /// @param model - a string with the model name (e.g. "res.partner") /// @param chain - a string with the initial field chain (e.g. "company_id.name") /// @param options - an object with several options: - /// - filters: an object which contains a series of filters to use - /// - debugMode: a boolean which is true if the widget is in debug mode + /// - filters: an object which contains suboptions which determine the fields which are used + /// - searchable: a boolean which is true if only the searchable fields have to be used (true by default) + /// - debugMode: a boolean which is true if the widget is in debug mode (false by default) init: function (parent, model, chain, options) { this._super.apply(this, arguments); @@ -130,6 +131,9 @@ var ModelFieldSelector = Widget.extend({ filters: {}, debugMode: false, }, options || {}); + this.options.filters = _.extend({ + searchable: true, + }, this.options.filters); this.pages = []; this.selectedField = false; @@ -307,7 +311,6 @@ var fieldsCache = { return this.cacheDefs[model]; }, filter: function (model, filters) { - filters = _.defaults(filters || {}, {searchable: true}); return _.filter(this.cache[model], function (f) { return !filters.searchable || f.searchable; }); -- cgit v1.2.3