[MERGE] from trunk
bzr revid: fva@openerp.com-20121005144933-zvtkq24i1188rsny
This commit is contained in:
commit
8fc09c1c78
|
@ -1622,7 +1622,7 @@ class Action(openerpweb.Controller):
|
|||
action = req.session.model(action_type).read([action_id], False, ctx)
|
||||
if action:
|
||||
value = clean_action(req, action[0], do_not_eval)
|
||||
return {'result': value}
|
||||
return value
|
||||
|
||||
@openerpweb.jsonrequest
|
||||
def run(self, req, action_id):
|
||||
|
|
|
@ -886,8 +886,8 @@ instance.web.UserMenu = instance.web.Widget.extend({
|
|||
var self = this;
|
||||
if (!this.getParent().has_uncommitted_changes()) {
|
||||
self.rpc("/web/action/load", { action_id: "base.action_res_users_my" }, function(result) {
|
||||
result.result.res_id = instance.session.uid;
|
||||
self.getParent().action_manager.do_action(result.result);
|
||||
result.res_id = instance.session.uid;
|
||||
self.getParent().action_manager.do_action(result);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
@ -1121,7 +1121,7 @@ instance.web.WebClient = instance.web.Client.extend({
|
|||
var self = this;
|
||||
return this.rpc("/web/action/load", { action_id: options.action_id })
|
||||
.pipe(function (result) {
|
||||
var action = result.result;
|
||||
var action = result;
|
||||
if (options.needaction) {
|
||||
action.context.search_default_needaction_pending = true;
|
||||
}
|
||||
|
@ -1166,7 +1166,7 @@ instance.web.EmbeddedClient = instance.web.Client.extend({
|
|||
return $.when(this._super()).pipe(function() {
|
||||
return instance.session.session_authenticate(self.dbname, self.login, self.key, true).pipe(function() {
|
||||
return self.rpc("/web/action/load", { action_id: self.action_id }, function(result) {
|
||||
var action = result.result;
|
||||
var action = result;
|
||||
action.flags = _.extend({
|
||||
//views_switcher : false,
|
||||
search_view : false,
|
||||
|
|
|
@ -1212,7 +1212,7 @@ instance.web.form.FormRenderingEngine = instance.web.form.FormRenderingEngineInt
|
|||
|
||||
this.$form.appendTo(this.$target);
|
||||
|
||||
_.each(this.fields_to_init, function($elem) {
|
||||
var ws = _.map(this.fields_to_init, function($elem) {
|
||||
var name = $elem.attr("name");
|
||||
if (!self.fvg.fields[name]) {
|
||||
throw new Error("Field '" + name + "' specified in view could not be found.");
|
||||
|
@ -1228,7 +1228,10 @@ instance.web.form.FormRenderingEngine = instance.web.form.FormRenderingEngineInt
|
|||
}
|
||||
self.alter_field(w);
|
||||
self.view.register_field(w, $elem.attr("name"));
|
||||
w.replace($elem);
|
||||
return [w, $elem];
|
||||
});
|
||||
_.each(ws, function(w) {
|
||||
w[0].replace(w[1]);
|
||||
});
|
||||
_.each(this.tags_to_init, function($elem) {
|
||||
var tag_name = $elem[0].tagName.toLowerCase();
|
||||
|
@ -1578,6 +1581,10 @@ instance.web.form.DefaultFieldManager = instance.web.Widget.extend({
|
|||
this._super(parent);
|
||||
this.field_descs = {};
|
||||
this.eval_context = eval_context || {};
|
||||
this.set({
|
||||
display_invalid_fields: false,
|
||||
actual_mode: 'create',
|
||||
});
|
||||
},
|
||||
get_field_desc: function(field_name) {
|
||||
if (this.field_descs[field_name] === undefined) {
|
||||
|
@ -1780,11 +1787,13 @@ instance.web.form.FormWidget = instance.web.Widget.extend(instance.web.form.Invi
|
|||
|
||||
this.field_manager.on("view_content_has_changed", this, this.process_modifiers);
|
||||
|
||||
this.set({required: this.modifiers['required'] === true});
|
||||
this.set({
|
||||
required: false,
|
||||
readonly: false,
|
||||
});
|
||||
// some events to make the property "effective_readonly" sync automatically with "readonly" and
|
||||
// "mode" on field_manager
|
||||
var self = this;
|
||||
this.set({"readonly": this.modifiers['readonly'] === true});
|
||||
var test_effective_readonly = function() {
|
||||
self.set({"effective_readonly": self.get("readonly") || self.field_manager.get("actual_mode") === "view"});
|
||||
};
|
||||
|
@ -1793,6 +1802,7 @@ instance.web.form.FormWidget = instance.web.Widget.extend(instance.web.form.Invi
|
|||
test_effective_readonly.call(this);
|
||||
},
|
||||
renderElement: function() {
|
||||
this.process_modifiers();
|
||||
this._super();
|
||||
this.$el.addClass(this.node.attrs["class"] || "");
|
||||
},
|
||||
|
@ -3975,6 +3985,7 @@ instance.web.form.FieldMany2Many = instance.web.form.AbstractField.extend({
|
|||
disable_utility_classes: true,
|
||||
init: function(field_manager, node) {
|
||||
this._super(field_manager, node);
|
||||
this.set({"value": []});
|
||||
this.is_loaded = $.Deferred();
|
||||
this.initial_is_loaded = this.is_loaded;
|
||||
this.is_setted = $.Deferred();
|
||||
|
@ -4601,18 +4612,14 @@ instance.web.form.FieldReference = instance.web.form.AbstractField.extend(instan
|
|||
}
|
||||
},
|
||||
destroy_content: function() {
|
||||
if (this.selection) {
|
||||
this.selection.destroy();
|
||||
this.selection = undefined;
|
||||
}
|
||||
if (this.m2o) {
|
||||
this.m2o.destroy();
|
||||
this.m2o = undefined;
|
||||
if (this.fm) {
|
||||
this.fm.destroy();
|
||||
}
|
||||
},
|
||||
initialize_content: function() {
|
||||
var self = this;
|
||||
var fm = new instance.web.form.DefaultFieldManager(this);
|
||||
this.fm = fm;
|
||||
fm.extend_field_desc({
|
||||
"selection": {
|
||||
selection: this.field_manager.get_field_desc(this.name).selection,
|
||||
|
|
|
@ -231,7 +231,7 @@ instance.web.ActionManager = instance.web.Widget.extend({
|
|||
} else if (_.isNumber(action) || _.isString(action)) {
|
||||
var self = this;
|
||||
return self.rpc("/web/action/load", { action_id: action }).pipe(function(result) {
|
||||
return self.do_action(result.result, on_close, clear_breadcrumbs, on_reverse_breadcrumb);
|
||||
return self.do_action(result, on_close, clear_breadcrumbs, on_reverse_breadcrumb);
|
||||
});
|
||||
}
|
||||
if (!action.type) {
|
||||
|
@ -1223,7 +1223,7 @@ instance.web.View = instance.web.Widget.extend({
|
|||
};
|
||||
|
||||
if (action_data.special) {
|
||||
return handler({result: {"type":"ir.actions.act_window_close"}});
|
||||
return handler({"type":"ir.actions.act_window_close"});
|
||||
} else if (action_data.type=="object") {
|
||||
var args = [[record_id]], additional_args = [];
|
||||
if (action_data.args) {
|
||||
|
|
Loading…
Reference in New Issue