[FIX] small problem with m2o, does not uses context when opening them in read-only mode
bzr revid: nicolas.vanhoren@openerp.com-20130319102719-0gdwvmix4d3x8th5
This commit is contained in:
parent
19daf7569d
commit
c55de6996f
|
@ -969,7 +969,10 @@ instance.web.CompoundContext = instance.web.Class.extend({
|
|||
},
|
||||
get_eval_context: function () {
|
||||
return this.__eval_context;
|
||||
}
|
||||
},
|
||||
eval: function() {
|
||||
return instance.web.pyeval.eval('context', this, undefined, {no_user_context: true});
|
||||
},
|
||||
});
|
||||
|
||||
instance.web.CompoundDomain = instance.web.Class.extend({
|
||||
|
@ -992,7 +995,10 @@ instance.web.CompoundDomain = instance.web.Class.extend({
|
|||
},
|
||||
get_eval_context: function() {
|
||||
return this.__eval_context;
|
||||
}
|
||||
},
|
||||
eval: function() {
|
||||
return instance.web.pyeval.eval('domain', this);
|
||||
},
|
||||
});
|
||||
|
||||
instance.web.DropMisordered = instance.web.Class.extend({
|
||||
|
|
|
@ -603,7 +603,7 @@ openerp.web.pyeval = function (instance) {
|
|||
});
|
||||
|
||||
var eval_contexts = function (contexts, evaluation_context) {
|
||||
evaluation_context = evaluation_context || {};
|
||||
evaluation_context = _.extend(instance.web.pyeval.context(), evaluation_context || {});
|
||||
return _(contexts).reduce(function (result_context, ctx) {
|
||||
// __eval_context evaluations can lead to some of `contexts`'s
|
||||
// values being null, skip them as well as empty contexts
|
||||
|
@ -628,9 +628,10 @@ openerp.web.pyeval = function (instance) {
|
|||
// siblings
|
||||
_.extend(evaluation_context, evaluated);
|
||||
return _.extend(result_context, evaluated);
|
||||
}, _.extend({}, instance.session.user_context));
|
||||
}, {});
|
||||
};
|
||||
var eval_domains = function (domains, evaluation_context) {
|
||||
evaluation_context = _.extend(instance.web.pyeval.context(), evaluation_context || {});
|
||||
var result_domain = [];
|
||||
_(domains).each(function (domain) {
|
||||
if (_.isString(domain)) {
|
||||
|
@ -657,6 +658,7 @@ openerp.web.pyeval = function (instance) {
|
|||
return result_domain;
|
||||
};
|
||||
var eval_groupbys = function (contexts, evaluation_context) {
|
||||
evaluation_context = _.extend(instance.web.pyeval.context(), evaluation_context || {});
|
||||
var result_group = [];
|
||||
_(contexts).each(function (ctx) {
|
||||
if (_.isString(ctx)) {
|
||||
|
@ -707,14 +709,15 @@ openerp.web.pyeval = function (instance) {
|
|||
* @param {Array} object domains or contexts to evaluate
|
||||
* @param {Object} [context] evaluation context
|
||||
*/
|
||||
instance.web.pyeval.eval = function (type, object, context) {
|
||||
instance.web.pyeval.eval = function (type, object, context, options) {
|
||||
options = options || {};
|
||||
context = _.extend(instance.web.pyeval.context(), context || {});
|
||||
context['context'] = py.dict.fromJSON(context);
|
||||
|
||||
//noinspection FallthroughInSwitchStatementJS
|
||||
switch(type) {
|
||||
case 'context': object = [object];
|
||||
case 'contexts': return eval_contexts(object, context);
|
||||
case 'contexts': return eval_contexts((options.no_user_context ? [] : [instance.session.user_context]).concat(object), context);
|
||||
case 'domain': object = [object];
|
||||
case 'domains': return eval_domains(object, context);
|
||||
case 'groupbys': return eval_groupbys(object, context);
|
||||
|
|
|
@ -3277,7 +3277,8 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc
|
|||
res_model: self.field.relation,
|
||||
res_id: self.get("value"),
|
||||
views: [[false, 'form']],
|
||||
target: 'current'
|
||||
target: 'current',
|
||||
context: self.build_context().eval(),
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue