diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index 2c91d6e4e19..544469c3f9c 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -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', diff --git a/doc/source/rpc.rst b/doc/source/rpc.rst index 672173f6469..5dea140c798 100644 --- a/doc/source/rpc.rst +++ b/doc/source/rpc.rst @@ -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.