diff options
| author | Antony Lesuisse <al@openerp.com> | 2011-12-08 14:39:52 +0100 |
|---|---|---|
| committer | Antony Lesuisse <al@openerp.com> | 2011-12-08 14:39:52 +0100 |
| commit | 78312ed1dd77aff07951cf5646bb4e38e51becb6 (patch) | |
| tree | 7c36ad833ac86d01f242995a722e5f609ce35312 /addons/web/static/src/js/data.js | |
| parent | 3225e9d5c42d7396ba9e3089e46c494bf919e283 (diff) | |
| parent | 54f3f38957fc36fbb705524b99cc2af0b5aceeca (diff) | |
[MERGE] trunk
bzr revid: al@openerp.com-20111208133952-183wp4ozrr0gvea8
Diffstat (limited to 'addons/web/static/src/js/data.js')
| -rw-r--r-- | addons/web/static/src/js/data.js | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index 1f2520ee774..26147b4d4e0 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -265,14 +265,25 @@ openerp.web.DataSet = openerp.web.Widget.extend( /** @lends openerp.web.DataSet return this; }, select_id: function(id) { - var idx = _.indexOf(this.ids, id); - if (idx === -1) { + var idx = this.get_id_index(id); + if (idx === null) { return false; } else { this.index = idx; return true; } }, + get_id_index: function(id) { + for (var i=0, ii=this.ids.length; i<ii; i++) { + // Here we use type coercion because of the mess potentially caused by + // OpenERP ids fetched from the DOM as string. (eg: dhtmlxcalendar) + // OpenERP ids can be non-numeric too ! (eg: recursive events in calendar) + if (id == this.ids[i]) { + return i; + } + } + return null; + }, /** * Read records. * @@ -414,8 +425,8 @@ openerp.web.DataSet = openerp.web.Widget.extend( /** @lends openerp.web.DataSet return this.rpc('/web/dataset/call', { model: this.model, method: method, - domain_id: domain_index || null, - context_id: context_index || null, + domain_id: domain_index == undefined ? null : domain_index, + context_id: context_index == undefined ? null : context_index, args: args || [] }, callback, error_callback); }, @@ -433,7 +444,7 @@ openerp.web.DataSet = openerp.web.Widget.extend( /** @lends openerp.web.DataSet model: this.model, method: method, domain_id: null, - context_id: 1, + context_id: args.length - 1, args: args || [] }, callback, error_callback); }, |
