[IMP] data: skip read_ids call when got no id (opw 604099).
authorMartin Trigaux <mat@openerp.com>
Tue, 18 Feb 2014 10:14:38 +0000 (11:14 +0100)
committerMartin Trigaux <mat@openerp.com>
Tue, 18 Feb 2014 10:14:38 +0000 (11:14 +0100)
This avoids making useless calls to to read the values of o2m fields when the read on a record already told us there was no ids.

bzr revid: mat@openerp.com-20140218101438-yqim33cvtg6wt4mw

addons/web/static/src/js/data.js

index abfb4c1..04b0229 100644 (file)
@@ -428,6 +428,9 @@ instance.web.DataSet =  instance.web.Class.extend(instance.web.PropertiesMixin,
      * @returns {$.Deferred}
      */
     read_ids: function (ids, fields, options) {
+        if (_.isEmpty(ids))
+            return $.Deferred().resolve([]);
+            
         options = options || {};
         // TODO: reorder results to match ids list
         return this._model.call('read',