summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/widgets/domain_selector_tests.js
diff options
context:
space:
mode:
authorMartin Geubelle <mge@odoo.com>2017-11-08 12:42:55 +0100
committerMartin Geubelle <mge@odoo.com>2017-11-08 17:19:28 +0100
commitc13c9e0b5c6ff8a8ae030ff2467d4675fb6197b8 (patch)
tree5d20f76d79d417c35fbfb03e02d35a5320d09be8 /addons/web/static/tests/widgets/domain_selector_tests.js
parent9f0bc83788d0a137f8b2c02aaa2cb8ece6628b85 (diff)
[FIX] web: invalid domain in DomainSelector
A domain could contain the key `parent` (in an embedded subview), like: domain="[('display_name', '=', parent.display_name)]") This is currently not handled by the DomainSelector. This will probably be handled in a future version but for this stable version, this case that triggered an error is now catched and an error message is displayed in the widget. This was causing a traceback when opening a domain with `parent` in the edition of a subview with Studio.
Diffstat (limited to 'addons/web/static/tests/widgets/domain_selector_tests.js')
-rw-r--r--addons/web/static/tests/widgets/domain_selector_tests.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/addons/web/static/tests/widgets/domain_selector_tests.js b/addons/web/static/tests/widgets/domain_selector_tests.js
index 55ddc971642..aca017e831c 100644
--- a/addons/web/static/tests/widgets/domain_selector_tests.js
+++ b/addons/web/static/tests/widgets/domain_selector_tests.js
@@ -194,6 +194,25 @@ QUnit.module('DomainSelector', {
domainSelector.destroy();
});
+
+ QUnit.test("editing a domain with `parent` key", function (assert) {
+ assert.expect(1);
+
+ var $target = $("#qunit-fixture");
+
+ // Create the domain selector and its mock environment
+ var domainSelector = new DomainSelector(null, "product", "[['name','=',parent.foo]]", {
+ debugMode: true,
+ readonly: false,
+ });
+ testUtils.addMockEnvironment(domainSelector, {data: this.data});
+ domainSelector.appendTo($target);
+
+ assert.strictEqual(domainSelector.$el.text(), "This domain is not supported.",
+ "an error message should be displayed because of the `parent` key");
+
+ domainSelector.destroy();
+ });
});
});
});