[FIX] correctly set dataset index when selecting a record in list view, so switching to page/form switches to the first selected record, not the first record of the page
lp bug: https://launchpad.net/bugs/939314 fixed bzr revid: xmo@openerp.com-20120223145157-rkkwg6pwcr6hh7st
This commit is contained in:
parent
819334f0aa
commit
a55e7148e3
|
@ -540,19 +540,17 @@ openerp.web.ListView = openerp.web.View.extend( /** @lends openerp.web.ListView#
|
|||
* @param {Array} records selected record values
|
||||
*/
|
||||
do_select: function (ids, records) {
|
||||
this.$element.find('.oe-list-delete')
|
||||
.attr('disabled', !ids.length);
|
||||
if (this.sidebar) {
|
||||
if (ids.length) {
|
||||
this.sidebar.do_unfold();
|
||||
} else {
|
||||
this.sidebar.do_fold();
|
||||
}
|
||||
}
|
||||
if (!records.length) {
|
||||
this.$element.find('.oe-list-delete').attr('disabled', !ids.length);
|
||||
if (!ids.length) {
|
||||
this.dataset.index = 0;
|
||||
if (this.sidebar) { this.sidebar.do_fold(); }
|
||||
this.compute_aggregates();
|
||||
return;
|
||||
}
|
||||
|
||||
this.dataset.index = _(this.dataset.ids).indexOf(ids[0]);
|
||||
if (this.sidebar) { this.sidebar.do_unfold(); }
|
||||
|
||||
this.compute_aggregates(_(records).map(function (record) {
|
||||
return {count: 1, values: record};
|
||||
}));
|
||||
|
|
Loading…
Reference in New Issue