summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/widgets
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2017-01-19 15:06:29 +0100
committerqsm-odoo <qsm@odoo.com>2017-01-31 11:38:46 +0100
commit3c452a2ecd73c1f6d739fd4d8db1f5f6313fd752 (patch)
treebff7c6f569fa3e0860efc7762c26df47dcad1d73 /addons/web/static/src/js/widgets
parent129be7ff78ca080f780814472943fe2c5e901429 (diff)
[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).
Diffstat (limited to 'addons/web/static/src/js/widgets')
-rw-r--r--addons/web/static/src/js/widgets/domain_selector.js5
-rw-r--r--addons/web/static/src/js/widgets/domain_selector_dialog.js1
-rw-r--r--addons/web/static/src/js/widgets/model_field_selector.js9
3 files changed, 8 insertions, 7 deletions
diff --git a/addons/web/static/src/js/widgets/domain_selector.js b/addons/web/static/src/js/widgets/domain_selector.js
index 8ae15325d34..90c13595208 100644
--- a/addons/web/static/src/js/widgets/domain_selector.js
+++ b/addons/web/static/src/js/widgets/domain_selector.js
@@ -58,19 +58,18 @@ var DomainNode = Widget.extend({
/// @param domain - an array of the prefix representation of the domain (or a string which represents it)
/// @param options - an object with possible values:
/// - readonly, a boolean to indicate if the widget is readonly or not (default to true)
- /// - fs_filters, an object with a series of filters to use for the field selector (see @FieldSelector)
+ /// - debugMode, a boolean which is true if the widget should be in debug mode (default to false)
+ /// - @see ModelFieldSelector for other options
init: function (parent, model, domain, options) {
this._super.apply(this, arguments);
this.model = model;
this.options = _.extend({
readonly: true,
- fs_filters: {},
debugMode: false,
}, options || {});
this.readonly = this.options.readonly;
- this.fs_filters = this.options.fs_filters;
this.debug = this.options.debugMode;
},
/// The getDomain method is an abstract method which should returns the prefix domain
diff --git a/addons/web/static/src/js/widgets/domain_selector_dialog.js b/addons/web/static/src/js/widgets/domain_selector_dialog.js
index 47bfa4e1359..c8f48d0ddc8 100644
--- a/addons/web/static/src/js/widgets/domain_selector_dialog.js
+++ b/addons/web/static/src/js/widgets/domain_selector_dialog.js
@@ -12,7 +12,6 @@ return Dialog.extend({
this.model = model;
this.options = _.extend({
readonly: true,
- fs_filters: {},
debugMode: false,
}, options || {});
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;
});