[FIX] Model#call not working correctly if the second argument (after method) is the kwargs

bzr revid: xmo@openerp.com-20120302100742-p1wrg44ght8d3cdy
This commit is contained in:
Xavier Morel 2012-03-02 11:07:42 +01:00
parent 1aed1963c0
commit 2c2df2b325
2 changed files with 7 additions and 2 deletions

View File

@ -192,6 +192,11 @@ openerp.web.Model = openerp.web.Class.extend(/** @lends openerp.web.Model# */{
call: function (method, args, kwargs) {
args = args || [];
kwargs = kwargs || {};
if (!_.isArray(args)) {
// call(method, kwargs)
kwargs = args;
args = [];
}
return openerp.connection.rpc('/web/dataset/call_kw', {
model: this.name,
method: method,
@ -783,7 +788,7 @@ openerp.web.DataSet = openerp.web.OldWidget.extend( /** @lends openerp.web.Data
* @returns {$.Deferred}
*/
name_search: function (name, domain, operator, limit, callback) {
return this._model.call('name_search', [], {
return this._model.call('name_search', {
name: name || '',
args: domain || false,
operator: operator || 'ilike',

View File

@ -80,7 +80,7 @@ around and use them differently/add new specifications on them.
name of the OpenERP model this object is bound to
.. js:function:: openerp.web.Model.call(method, args, kwargs)
.. js:function:: openerp.web.Model.call(method[, args][, kwargs])
Calls the ``method`` method of the current model, with the
provided positional and keyword arguments.