From: Xavier Morel Date: Thu, 15 Dec 2011 15:41:00 +0000 (+0100) Subject: [FIX] static datasets: don't set the index to 0 if there are no ids at all, the form... X-Git-Tag: 6.1.0-rc1-addons~626 X-Git-Url: http://git.inspyration.org/?a=commitdiff_plain;h=308c97596732fa5a354efe801a0752303e4b6402;p=odoo%2Fodoo.git [FIX] static datasets: don't set the index to 0 if there are no ids at all, the form view does not like it lp bug: https://launchpad.net/bugs/899043 fixed bzr revid: xmo@openerp.com-20111215154100-aspzga71cng767u8 --- diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index aec701e..46393aa 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -510,9 +510,10 @@ openerp.web.DataSetStatic = openerp.web.DataSet.extend({ }, set_ids: function (ids) { this.ids = ids; - if (this.index !== null) { - this.index = this.index <= this.ids.length - 1 ? - this.index : (this.ids.length > 0 ? this.length - 1 : 0); + if (ids.length === 0) { + this.index = null; + } else if (this.index >= ids.length - 1) { + this.index = ids.length - 1; } }, unlink: function(ids) {