[IMP]remove callback from call_button and improve related code.

bzr revid: vme@tinyerp.com-20120928063558-roez0oayft9l3y4n
This commit is contained in:
Vidhin Mehta (OpenERP) 2012-09-28 12:05:58 +05:30
parent 6d692fac36
commit 7730c14855
2 changed files with 5 additions and 6 deletions

View File

@ -708,9 +708,8 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({
* @param {Function} error_callback * @param {Function} error_callback
* @returns {$.Deferred} * @returns {$.Deferred}
*/ */
call_button: function (method, args, callback, error_callback) { call_button: function (method, args) {
return this._model.call_button(method, args) return this._model.call_button(method, args);
.then(callback, error_callback);
}, },
/** /**
* Fetches the "readable name" for records, based on intrinsic rules * Fetches the "readable name" for records, based on intrinsic rules
@ -1052,7 +1051,7 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({
} }
return completion.promise(); return completion.promise();
}, },
call_button: function (method, args, callback, error_callback) { call_button: function (method, args) {
var id = args[0][0], index; var id = args[0][0], index;
for(var i=0, len=this.cache.length; i<len; ++i) { for(var i=0, len=this.cache.length; i<len; ++i) {
var record = this.cache[i]; var record = this.cache[i];
@ -1063,7 +1062,7 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({
break; break;
} }
} }
return this._super(method, args, callback, error_callback); return this._super(method, args);
}, },
alter_ids: function(n_ids) { alter_ids: function(n_ids) {
this._super(n_ids); this._super(n_ids);

View File

@ -1215,7 +1215,7 @@ instance.web.View = instance.web.Widget.extend({
} }
} }
args.push(context); args.push(context);
return dataset.call_button(action_data.name, args, handler); return dataset.call_button(action_data.name, args).then(handler(r));
} else if (action_data.type=="action") { } else if (action_data.type=="action") {
return this.rpc('/web/action/load', { action_id: action_data.name, context: context, do_not_eval: true}, handler); return this.rpc('/web/action/load', { action_id: action_data.name, context: context, do_not_eval: true}, handler);
} else { } else {