summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js
diff options
context:
space:
mode:
authorMartin Trigaux <mat@openerp.com>2014-02-13 09:50:08 +0100
committerMartin Trigaux <mat@openerp.com>2014-02-13 09:50:08 +0100
commit409c3cfe9f1cdda1b8d9672fc3c0c246ed425894 (patch)
treea9d528077ad341665723bfbbb90eaaba7ea90d9f /addons/web/static/src/js
parentfaf6d33bc0c9baee79129c679901d9106d205f63 (diff)
[FIX] data: _.find (prefered to older _.detect) may return undefined if no match and would trow an error when applying .values
Instead returns undefined which is handled below. This does not solve the issue when records are not loaded properly but gives a better information on the reason. bzr revid: mat@openerp.com-20140213085008-pnq4r0ebfl072u78
Diffstat (limited to 'addons/web/static/src/js')
-rw-r--r--addons/web/static/src/js/data.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js
index e1290deac02..abfb4c15347 100644
--- a/addons/web/static/src/js/data.js
+++ b/addons/web/static/src/js/data.js
@@ -848,7 +848,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)) {