diff options
| author | Goffin Simon <sig@odoo.com> | 2018-01-31 15:45:48 +0100 |
|---|---|---|
| committer | Goffin Simon <sig@odoo.com> | 2018-02-01 10:31:14 +0100 |
| commit | 695bd75a1383e88099a79de89db9ee1042c83d5e (patch) | |
| tree | 843c9d65b1d964d2bb6444ae8d3df2d34166de17 /addons/web/static/src | |
| parent | 2629029d03b4c645759961b1fce9bde5566530a1 (diff) | |
[FIX] web: invalid domain in DomainSelector
Backport of this commit: c13c9e0b5c6ff8a8ae030ff2467d4675fb6197b8
Steps to reproduce the bug:
- install application MRP Maintenance
- open maintenance request form view, and from top right corner click Studio icon
- click on Equipment field while you are still in studio interface
- It will show left side studio panel, click Domain box and it will throw an error
opw:813594
Diffstat (limited to 'addons/web/static/src')
| -rw-r--r-- | addons/web/static/src/js/widgets/domain_selector.js | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/addons/web/static/src/js/widgets/domain_selector.js b/addons/web/static/src/js/widgets/domain_selector.js index eccbd9d7491..5fd517ebc6f 100644 --- a/addons/web/static/src/js/widgets/domain_selector.js +++ b/addons/web/static/src/js/widgets/domain_selector.js @@ -110,7 +110,16 @@ var DomainTree = DomainNode.extend({ /// @see DomainTree._addFlattenedChildren init: function (parent, model, domain, options) { this._super.apply(this, arguments); - this._initialize(domainUtils.stringToDomain(domain)); + try { + domain = domainUtils.stringToDomain(domain); + } catch (err) { + // TODO: domain could contain `parent` for example, which is + // currently not handled by the DomainSelector + this.invalidDomain = true; + this.children = []; + return; + } + this._initialize(domain); }, /// @see DomainTree.init _initialize: function (domain) { @@ -279,6 +288,18 @@ var DomainSelector = DomainTree.extend({ } }, }), + + start: function () { + var self = this; + return this._super.apply(this, arguments).then(function () { + if (self.invalidDomain) { + var msg = _t("This domain is not supported."); + self.$el.html(msg); + } + }); + }, + + _initialize: function (domain) { // Check if the domain starts with implicit "&" operators and make them // explicit. As the DomainSelector is a specialization of a DomainTree, |
