summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/_deprecated
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2017-02-23 10:36:13 +0100
committerAaron Bohy <aab@odoo.com>2017-04-11 19:44:38 +0200
commit136292f6890ff730b5a9fd70eb503d4f6a0f9c4a (patch)
tree3ded3049b78c6c901acbdd1b5609d9f77bfd2b3e /addons/web/static/src/js/_deprecated
parent173896b62d2c2d3c4acc6be75c3396b29887e4fb (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/_deprecated')
-rw-r--r--addons/web/static/src/js/_deprecated/data.js36
-rw-r--r--addons/web/static/src/js/_deprecated/data_model.js5
2 files changed, 8 insertions, 33 deletions
diff --git a/addons/web/static/src/js/_deprecated/data.js b/addons/web/static/src/js/_deprecated/data.js
index 090325b0057..66469ff1374 100644
--- a/addons/web/static/src/js/_deprecated/data.js
+++ b/addons/web/static/src/js/_deprecated/data.js
@@ -2,6 +2,7 @@ odoo.define('web.data', function (require) {
"use strict";
var Class = require('web.Class');
+var Context = require('web.Context');
var concurrency = require('web.concurrency');
var mixins = require('web.mixins');
var Model = require('web.Model');
@@ -68,7 +69,7 @@ var Query = Class.extend({
q._filter, to_set.filter);
break;
case 'context':
- q._context = new CompoundContext(
+ q._context = new Context(
q._context, to_set.context);
break;
case 'lazy':
@@ -379,7 +380,7 @@ var DataSet = Class.extend(mixins.PropertiesMixin, {
if (options.check_access_rule === true){
method = 'search_read';
ids_arg = [['id', 'in', ids]];
- context = new CompoundContext(context, {active_test: false});
+ context = new Context(context, {active_test: false});
}
return this._model.call(method,
[ids_arg, fields || false],
@@ -729,32 +730,6 @@ var DataSetSearch = DataSet.extend({
}
});
-var CompoundContext = 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);
- },
-});
-
var CompoundDomain = Class.extend({
init: function () {
this.__ref = "compound_domain";
@@ -799,13 +774,13 @@ function build_eval_context (record) {
field_values.active_ids = [record.data.id];
}
// FIXME: parent?
- return new CompoundContext(field_values);
+ return new Context(field_values);
}
function build_context(record, context) {
context = context || {};
var eval_context = build_eval_context(record);
- return new CompoundContext(context).set_eval_context(eval_context);
+ return new Context(context).set_eval_context(eval_context);
}
function build_domain(record, domain) {
@@ -819,7 +794,6 @@ return {
DataSet: DataSet,
DataSetStatic: DataSetStatic,
DataSetSearch: DataSetSearch,
- CompoundContext: CompoundContext,
CompoundDomain: CompoundDomain,
noDisplayContent: "<em class=\"text-warning\">" + _t("Unnamed") + "</em>",
build_context: build_context,
diff --git a/addons/web/static/src/js/_deprecated/data_model.js b/addons/web/static/src/js/_deprecated/data_model.js
index f722339167f..3bae06a3f4c 100644
--- a/addons/web/static/src/js/_deprecated/data_model.js
+++ b/addons/web/static/src/js/_deprecated/data_model.js
@@ -1,6 +1,7 @@
odoo.define('web.DataModel', function (require) {
"use strict";
+var Context = require('web.Context');
var data = require('web.data');
var Model = require('web.Model');
var pyeval = require('web.pyeval');
@@ -31,10 +32,10 @@ Model.include({
* combined with the provided context if any
*
* @param {Object} [context] to combine with the model's internal context
- * @returns {instance.web.CompoundContext} The union of the user's context and the model's internal context, as well as the provided context if any. In that order.
+ * @returns {web.Context} The union of the user's context and the model's internal context, as well as the provided context if any. In that order.
*/
context: function (context) {
- return new data.CompoundContext(session.user_context, this._context, context || {});
+ return new Context(session.user_context, this._context, context || {});
},
/**
* Call a method (over RPC) on the bound OpenERP model.