From 136292f6890ff730b5a9fd70eb503d4f6a0f9c4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Thu, 23 Feb 2017 10:36:13 +0100 Subject: [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' --- addons/web/static/src/js/core/context.js | 35 ++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 addons/web/static/src/js/core/context.js (limited to 'addons/web/static/src/js/core/context.js') 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 -- cgit v1.2.3