diff options
| author | Xavier Morel <xmo@openerp.com> | 2012-04-04 13:48:30 +0200 |
|---|---|---|
| committer | Xavier Morel <xmo@openerp.com> | 2012-04-04 13:48:30 +0200 |
| commit | 239a118913049dfb29d517a06dde3ce6d23745e8 (patch) | |
| tree | a174b4c2b267756dae05f0fd2372819480b237e3 /addons/web/static/src/js/core.js | |
| parent | 2a8d78c88ccdbdffdad39e41539068bb8fc32fe5 (diff) | |
[FIX] compound domain and context's eval_context can be a compound itself, evaluate those if needs be
also fix tests html file for renames and extracts, and add a test case for complex non-literal evaluation contexts
bzr revid: xmo@openerp.com-20120404114830-a6416m2v7h8cyf08
Diffstat (limited to 'addons/web/static/src/js/core.js')
| -rw-r--r-- | addons/web/static/src/js/core.js | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/addons/web/static/src/js/core.js b/addons/web/static/src/js/core.js index a79df217a5a..abbcc780ee2 100644 --- a/addons/web/static/src/js/core.js +++ b/addons/web/static/src/js/core.js @@ -13,7 +13,7 @@ openerp.web.core = function(openerp) { // a function to override the "extend()" method of JR's inheritance, allowing // the usage of "include()" -oe_override_class = function(claz){ +var oe_override_class = function(claz){ var initializing = false, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/; @@ -625,16 +625,20 @@ openerp.web.Connection = openerp.web.CallbackEnabled.extend( /** @lends openerp. var result_context = _.extend({}, this.user_context), self = this; _(contexts).each(function (ctx) { + // __eval_context evaluations can lead to some of `contexts`'s + // values being null, skip them as well as empty contexts + if (_.isEmpty(ctx)) { return; } switch(ctx.__ref) { case 'context': _.extend(result_context, py.eval( ctx.__debug, evaluation_context)); break; case 'compound_context': + var eval_context = self.test_eval_contexts([ctx.__eval_context]); _.extend( result_context, self.test_eval_contexts( ctx.__contexts, _.extend( - {}, evaluation_context, ctx.__eval_context))); + {}, evaluation_context, eval_context))); break; default: _.extend(result_context, ctx); @@ -642,19 +646,20 @@ openerp.web.Connection = openerp.web.CallbackEnabled.extend( /** @lends openerp. }); return result_context; }, - test_eval_domains: function (domains, eval_context) { + test_eval_domains: function (domains, evaluation_context) { var result_domain = [], self = this; _(domains).each(function (dom) { switch(dom.__ref) { case 'domain': result_domain.push.apply( - result_domain, py.eval(dom.__debug, eval_context)); + result_domain, py.eval(dom.__debug, evaluation_context)); break; case 'compound_domain': + var eval_context = self.test_eval_contexts([dom.__eval_context]); result_domain.push.apply( result_domain, self.test_eval_domains( dom.__domains, _.extend( - {}, eval_context, dom.__eval_context))); + {}, evaluation_context, eval_context))); break; default: result_domain.push.apply( |
