You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

27 lines
1.0 KiB

openerp.web_context_tunnel = function(instance) {
instance.web.form.FormWidget.prototype.build_context = function() {
var v_context = false;
var fields_values = false;
// instead of using just the attr context, we merge any attr starting with context
for (var key in this.node.attrs) {
if (key.substring(0, 7) === "context") {
if (!v_context) {
fields_values = this.field_manager.build_eval_context();
v_context = new instance.web.CompoundContext(this.node.attrs[key]).set_eval_context(fields_values);
} else {
v_context = new instance.web.CompoundContext(this.node.attrs[key], v_context).set_eval_context(fields_values);
}
}
}
if (!v_context) {
v_context = (this.field || {}).context || {};
v_context = new instance.web.CompoundContext(v_context);
}
return v_context;
};
};
// vim:et fdc=0 fdl=0: