diff options
| author | Géry Debongnie <ged@odoo.com> | 2017-02-23 10:36:13 +0100 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2017-04-11 19:44:38 +0200 |
| commit | 136292f6890ff730b5a9fd70eb503d4f6a0f9c4a (patch) | |
| tree | 3ded3049b78c6c901acbdd1b5609d9f77bfd2b3e /addons/web/static/src/js/core | |
| parent | 173896b62d2c2d3c4acc6be75c3396b29887e4fb (diff) | |
[REF] web, *: move CompoundContext out of data.js
We want to remove data.js, but we still need the CompoundContext class,
so we take it out, and rename it 'Context'
Diffstat (limited to 'addons/web/static/src/js/core')
| -rw-r--r-- | addons/web/static/src/js/core/context.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/addons/web/static/src/js/core/context.js b/addons/web/static/src/js/core/context.js new file mode 100644 index 00000000000..c63c9f15bd8 --- /dev/null +++ b/addons/web/static/src/js/core/context.js @@ -0,0 +1,35 @@ +odoo.define('web.Context', function (require) { +"use strict"; + +var Class = require('web.Class'); +var pyeval = require('web.pyeval'); + +var Context = Class.extend({ + init: function () { + this.__ref = "compound_context"; + this.__contexts = []; + this.__eval_context = null; + var self = this; + _.each(arguments, function(x) { + self.add(x); + }); + }, + add: function (context) { + this.__contexts.push(context); + return this; + }, + set_eval_context: function (eval_context) { + this.__eval_context = eval_context; + return this; + }, + get_eval_context: function () { + return this.__eval_context; + }, + eval: function() { + return pyeval.eval('context', this); + }, +}); + +return Context; + +});
\ No newline at end of file |
