summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/core/context.js
diff options
context:
space:
mode:
Diffstat (limited to 'addons/web/static/src/js/core/context.js')
-rw-r--r--addons/web/static/src/js/core/context.js35
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