[FIX] Modified behavior when we click on an action in the 'More' menu.

Since revision 1517, when using the sidebar from a form view, it merged all the fields of the form view in the context of the action.
It was modified to avoid that context pollution, now it only uses those fields to evaluate the context of that action. So it allows
specifying contexts like "{'invoice_id': invoice_id}", but invoice_id will not be propagated any more to the new action context if not
explicitely specified.

bzr revid: nicolas.vanhoren@openerp.com-20121120100620-ig4e02uctysk7oj8
This commit is contained in:
niv-openerp 2012-11-20 11:06:20 +01:00
parent 87d4e235a4
commit 999c0b2cab
2 changed files with 9 additions and 9 deletions

View File

@ -1009,8 +1009,8 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
}
return true;
},
sidebar_context: function () {
return this.save().then(_.bind(function() {return this.get_fields_values();}, this));
sidebar_eval_context: function () {
return $.when(this.build_eval_context());
},
open_defaults_dialog: function () {
var self = this;

View File

@ -1061,23 +1061,23 @@ instance.web.Sidebar = instance.web.Widget.extend({
},
on_item_action_clicked: function(item) {
var self = this;
self.getParent().sidebar_context().done(function (context) {
self.getParent().sidebar_eval_context().done(function (sidebar_eval_context) {
var ids = self.getParent().get_selected_ids();
if (ids.length == 0) {
instance.web.dialog($("<div />").text(_t("You must choose at least one record.")), { title: _t("Warning"), modal: true });
return false;
}
var additional_context = _.extend({
var active_ids_context = {
active_id: ids[0],
active_ids: ids,
active_model: self.getParent().dataset.model
}, context);
};
self.rpc("/web/action/load", {
action_id: item.action.id,
context: additional_context
context: new instance.web.CompoundContext(sidebar_eval_context, active_ids_context),
}).done(function(result) {
result.context = _.extend(result.context || {},
additional_context);
console.log(result.context);
result.context = new instance.web.CompoundContext(result.context || {}, active_ids_context);
result.flags = result.flags || {};
result.flags.new_window = true;
self.do_action(result, {
@ -1330,7 +1330,7 @@ instance.web.View = instance.web.Widget.extend({
on_sidebar_export: function() {
new instance.web.DataExport(this, this.dataset).open();
},
sidebar_context: function () {
sidebar_eval_context: function () {
return $.when();
},
/**