diff options
| author | qsm-odoo <qsm@odoo.com> | 2017-03-16 14:01:45 +0100 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2017-04-11 19:44:38 +0200 |
| commit | e1b68dae50a0ffd8eadeafd823acb328c429b7fe (patch) | |
| tree | 395582b27a9e374390a0cda780f13b8fc22c5116 /addons/web | |
| parent | f738edb1d65b5f92436f8ac0b69de42639a071e4 (diff) | |
[FIX] web, *: fix domain building without CompoundDomain
* board, google_spreadsheet
Commit 8e0c7ccc77f358601b0701536fcb33842ca324a6 got rid of the
CompoundDomain class but did not adapt the code correctly.
- Domains have to be concatened, not regrouped in a big array
- String domains have to be converted to array
- "OR" joining must normalize subdomains first (add explicit "AND"s)
Diffstat (limited to 'addons/web')
| -rw-r--r-- | addons/web/static/src/js/chrome/search_inputs.js | 6 | ||||
| -rw-r--r-- | addons/web/static/test/chrome/search_tests.js | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/addons/web/static/src/js/chrome/search_inputs.js b/addons/web/static/src/js/chrome/search_inputs.js index 41676b98e2e..aa02f9fe950 100644 --- a/addons/web/static/src/js/chrome/search_inputs.js +++ b/addons/web/static/src/js/chrome/search_inputs.js @@ -170,6 +170,7 @@ var Field = Input.extend( /** @lends instance.web.search.Field# */ { return domains[0]; } + _.each(domains, Domain.prototype.normalizeArray); var ors = _.times(domains.length - 1, _.constant("|")); return ors.concat.apply(ors, domains); } @@ -619,10 +620,14 @@ var FilterGroup = Input.extend(/** @lends instance.web.search.FilterGroup# */{ * @return {*} combined domains of the enabled filters in this group */ get_domain: function (facet) { + var userContext = this.getSession().user_context; var domains = facet.values.chain() .map(function (f) { return f.get('value').attrs.domain; }) .without('[]') .reject(_.isEmpty) + .map(function (d) { + return Domain.prototype.stringToArray(d, userContext); + }) .value(); if (!domains.length) { @@ -632,6 +637,7 @@ var FilterGroup = Input.extend(/** @lends instance.web.search.FilterGroup# */{ return domains[0]; } + _.each(domains, Domain.prototype.normalizeArray); var ors = _.times(domains.length - 1, _.constant("|")); return ors.concat.apply(ors, domains); }, diff --git a/addons/web/static/test/chrome/search_tests.js b/addons/web/static/test/chrome/search_tests.js index 5d188f428ec..c2d290134ed 100644 --- a/addons/web/static/test/chrome/search_tests.js +++ b/addons/web/static/test/chrome/search_tests.js @@ -129,7 +129,6 @@ QUnit.module('chrome', {}, function () { assert.strictEqual(query.length, 0, 'Should have removed the facet'); }); - QUnit.test('Intermediate emptiness should not remove the facet', function (assert) { assert.expect(3); @@ -167,5 +166,7 @@ QUnit.module('chrome', {}, function () { ]); }); + // TODO add a test to check that combining two filters with a or normalizes the two filters before + // Note: maybe domain.js will be improved to make this easier }); }); |
