diff options
| author | Gery Debongnie <ged@openerp.com> | 2014-02-25 10:13:10 +0100 |
|---|---|---|
| committer | Gery Debongnie <ged@openerp.com> | 2014-02-25 10:13:10 +0100 |
| commit | 893b7041f97a5f98dbb95affdfeecbcdb6db69ed (patch) | |
| tree | 463444a7e755b66a6fb3f7aefc5c5f2b6a6bf074 /addons/web/static/src/js/data.js | |
| parent | 2ab61cf001fab1d30050598931bfa39956cf4883 (diff) | |
| parent | eaa20f9586f5d9a7a52ed5a7cc565d620e0ad44a (diff) | |
[MERGE] merge from trunk
bzr revid: ged@openerp.com-20140225091310-pzkj5ip17esl52kz
Diffstat (limited to 'addons/web/static/src/js/data.js')
| -rw-r--r-- | addons/web/static/src/js/data.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index 78e3001d746..cc595c30688 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -452,6 +452,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', @@ -872,7 +875,8 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({ }); var return_records = function() { var records = _.map(ids, function(id) { - return _.extend({}, _.detect(self.cache, function(c) {return c.id === id;}).values, {"id": id}); + var c = _.find(self.cache, function(c) {return c.id === id;}); + return _.isUndefined(c) ? c : _.extend({}, c.values, {"id": id}); }); if (self.debug_mode) { if (_.include(records, undefined)) { |
