[FIX] when loading records in the listview, remember to set dataset index to 0 so switching to formview does not try to create a new record

lp bug: https://launchpad.net/bugs/816830 fixed

bzr revid: xmo@openerp.com-20110825145741-gduqtgrqw4bbuugl
This commit is contained in:
Xavier Morel 2011-08-25 16:57:41 +02:00
parent 3cfa390281
commit 238a0200a0
1 changed files with 29 additions and 20 deletions

View File

@ -382,10 +382,19 @@ openerp.base.ListView = openerp.base.View.extend( /** @lends openerp.base.ListVi
* re-renders the content of the list view
*/
reload_content: function () {
var self = this;
this.records.reset();
this.$element.find('.oe-listview-content').append(
this.groups.render(
$.proxy(this, 'compute_aggregates')));
this.groups.render(function () {
if (self.dataset.index == null) {
var has_one = false;
self.records.each(function () { has_one = true; });
if (has_one) {
self.dataset.index = 0;
}
}
self.compute_aggregates();
}));
},
/**
* Event handler for a search, asks for the computation/folding of domains