[ADD] in rpc_ajax, first parameter can be url or $.ajax option object (with url inside)

bzr revid: fme@openerp.com-20110407135042-plwyesu7o7minf9i
This commit is contained in:
Fabien Meghazi 2011-04-07 15:50:42 +02:00
parent 16b7ad769f
commit 56532b80be
1 changed files with 9 additions and 2 deletions

View File

@ -283,7 +283,13 @@ openerp.base.Session = openerp.base.BasicController.extend( /** @lends openerp.b
rpc_ajax: function(url, payload, success_callback, error_callback) {
var self = this;
this.on_rpc_request();
return $.ajax({
// url can be an $.ajax option object
if (_.isString(url)) {
url = {
url: url
}
}
var ajax = _.extend({
type: "POST",
url: url,
dataType: 'json',
@ -314,7 +320,8 @@ openerp.base.Session = openerp.base.BasicController.extend( /** @lends openerp.b
};
error_callback(error);
}
});
}, url);
return $.ajax(ajax);
},
on_rpc_request: function() {
},