[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
This commit is contained in:
Xavier Morel 2011-12-15 16:41:00 +01:00
parent 525d60523e
commit 308c975967
1 changed files with 4 additions and 3 deletions

View File

@ -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) {