summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/data.js
diff options
context:
space:
mode:
authorChristophe Simonis <chs@openerp.com>2014-03-18 12:27:43 +0100
committerChristophe Simonis <chs@openerp.com>2014-03-18 12:27:43 +0100
commitacb010a9852755668bbe3f2419ae5038683f4a93 (patch)
tree2e3c17a35176648a313d6483a3e415eda4f647df /addons/web/static/src/js/data.js
parentc2ba11e72e1e0ac5d1d93c476b510454d22f362c (diff)
parenta8d14c47df21ae4259fe13f9d96096561a0bf46b (diff)
[MERGE] forward port of branch 7.0 up to revid 4162 launchpad_translations_on_behalf_of_openerp-20140318062141-rdiqz2ptnz3qmxd0
bzr revid: chs@openerp.com-20140129095637-mbfz82r5pyz4dctc bzr revid: dle@openerp.com-20140210140818-5mtk1qhheo219bm1 bzr revid: dle@openerp.com-20140214114445-krexrwm9o2nrxepk bzr revid: mat@openerp.com-20140219111353-cxo860z7ctz7om30 bzr revid: dle@openerp.com-20140221120519-1pj3wc8kqgkr5uda bzr revid: chs@openerp.com-20140318112743-tqv492026y2pnbff
Diffstat (limited to 'addons/web/static/src/js/data.js')
-rw-r--r--addons/web/static/src/js/data.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js
index fa276afa88f..36459575898 100644
--- a/addons/web/static/src/js/data.js
+++ b/addons/web/static/src/js/data.js
@@ -447,6 +447,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',
@@ -867,7 +870,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)) {
@@ -895,6 +899,10 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({
sign = -1;
field = field.slice(1);
}
+ //m2o should be searched based on value[1] not based whole value(i.e. [id, value])
+ if(_.isArray(a[field]) && a[field].length == 2 && _.isString(a[field][1])){
+ return sign * compare(a[field][1], b[field][1]);
+ }
return sign * compare(a[field], b[field]);
}, 0);
});