From c4a845b50e2ca2c6750a512e1980282e4d6d57a3 Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Thu, 29 Nov 2012 11:40:39 +0100 Subject: [PATCH 1/3] [FIX] auth_signup on token bzr revid: al@openerp.com-20121129104039-0pv8mls0f55pet2l --- addons/auth_signup/static/src/js/auth_signup.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/auth_signup/static/src/js/auth_signup.js b/addons/auth_signup/static/src/js/auth_signup.js index a6b401a4c7b..241c2406d56 100644 --- a/addons/auth_signup/static/src/js/auth_signup.js +++ b/addons/auth_signup/static/src/js/auth_signup.js @@ -52,6 +52,8 @@ openerp.auth_signup = function(instance) { if (result.token) { // switch to signup mode, set user name and login this.$el.addClass("oe_login_signup"); + self.$(".oe_signup_show").show(); + self.$(".oe_signup_hide").hide(); this.$("form input[name=name]").val(result.name).attr("readonly", "readonly"); if (result.login) { this.$("form input[name=login]").val(result.login).attr("readonly", "readonly"); From a2b23a1ca71a25f912c5f92e8a1dbfdde69bc568 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Thu, 29 Nov 2012 12:23:50 +0100 Subject: [PATCH 2/3] [REM] merge conflict file committed bzr revid: xmo@openerp.com-20121129112350-egvxrg8ii71wzdx6 --- addons/web/static/test/test.html.THIS | 63 --------------------------- 1 file changed, 63 deletions(-) delete mode 100644 addons/web/static/test/test.html.THIS diff --git a/addons/web/static/test/test.html.THIS b/addons/web/static/test/test.html.THIS deleted file mode 100644 index f5f29f88d7c..00000000000 --- a/addons/web/static/test/test.html.THIS +++ /dev/null @@ -1,63 +0,0 @@ - - - - - OpenERP Web Test Suite - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - From fe3d493cc84583fbdd8da4917f9199fdef751dc0 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Thu, 29 Nov 2012 12:24:13 +0100 Subject: [PATCH 3/3] [FIX] searches with filters using "empty" domain/context values (but not attributes) e.g. @domain="[]" would be seen as non-empty by the search view, and if multiple domains the search view would generate a nonliteral ``['|', '[]', '[]]`` which would just yield ``['|']`` after evaluation and concatenation, which is an invalid domain and would blow up the server. Specifically filter out the values ``[]`` and ``{}`` from filters bzr revid: xmo@openerp.com-20121129112413-yrgncnesqs093jwf --- addons/web/static/src/js/search.js | 3 +++ addons/web/static/test/search.js | 36 ++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index 5b59c7d6912..3917f342391 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -1009,6 +1009,7 @@ instance.web.search.FilterGroup = instance.web.search.Input.extend(/** @lends in get_context: function (facet) { var contexts = facet.values.chain() .map(function (f) { return f.get('value').attrs.context; }) + .without('{}') .reject(_.isEmpty) .value(); @@ -1027,6 +1028,7 @@ instance.web.search.FilterGroup = instance.web.search.Input.extend(/** @lends in get_groupby: function (facet) { return facet.values.chain() .map(function (f) { return f.get('value').attrs.context; }) + .without('{}') .reject(_.isEmpty) .value(); }, @@ -1039,6 +1041,7 @@ instance.web.search.FilterGroup = instance.web.search.Input.extend(/** @lends in get_domain: function (facet) { var domains = facet.values.chain() .map(function (f) { return f.get('value').attrs.domain; }) + .without('[]') .reject(_.isEmpty) .value(); diff --git a/addons/web/static/test/search.js b/addons/web/static/test/search.js index 45f6d2c715b..db9e7aa3ed9 100644 --- a/addons/web/static/test/search.js +++ b/addons/web/static/test/search.js @@ -845,6 +845,42 @@ openerp.testing.section('search-serialization', { ok(!context.get_eval_context(), "context should have no evaluation context"); }); }); + test('Empty filter domains', {asserts: 4}, function (instance) { + var view = {inputs: [], query: {on: function () {}}}; + var filter_a = new instance.web.search.Filter( + {attrs: {name: 'a', context: '{}', domain: '[]'}}, view); + var filter_b = new instance.web.search.Filter( + {attrs: {name: 'b', context: '{}', domain: '[]'}}, view); + var filter_c = new instance.web.search.Filter( + {attrs: {name: 'c', context: '{b: 42}', domain: '[["a", "=", 3]]'}}, view); + var group = new instance.web.search.FilterGroup( + [filter_a, filter_b, filter_c], view); + var t1 = group.facet_for_defaults({a: true, c: true}) + .done(function (facet) { + var model = facet; + if (!(model instanceof instance.web.search.Facet)) { + model = new instance.web.search.Facet(facet); + } + + var domain = group.get_domain(model); + deepEqual(domain, '[["a", "=", 3]]', "domain should ignore empties"); + var context = group.get_context(model); + deepEqual(context, '{b: 42}', "context should ignore empties"); + }); + var t2 = group.facet_for_defaults({a: true, b: true}) + .done(function (facet) { + var model = facet; + if (!(model instanceof instance.web.search.Facet)) { + model = new instance.web.search.Facet(facet); + } + + var domain = group.get_domain(model); + equal(domain, null, "domain should ignore empties"); + var context = group.get_context(model); + equal(context, null, "context should ignore empties"); + }); + return $.when(t1, t2); + }); }); openerp.testing.section('removal', { dependencies: ['web.search'],