[FIX] moving between list and form views

bzr revid: xmo@openerp.com-20110520142041-7wk4d53459fvjbra
This commit is contained in:
Xavier Morel 2011-05-20 16:20:41 +02:00
parent 6ea547dc71
commit 96c7c16b5f
2 changed files with 17 additions and 5 deletions

View File

@ -112,7 +112,8 @@ openerp.base.ContainerDataGroup = openerp.base.DataGroup.extend(
var d = new $.Deferred();
var self = this;
if (this.groups) {
// disable caching for now, not sure what I should do there
if (false && this.groups) {
d.resolveWith(this, [this.groups]);
} else {
this.rpc('/base/group/read', {
@ -350,6 +351,7 @@ openerp.base.DataSetSearch = openerp.base.DataSet.extend({
offset: offset,
limit: limit
}, function (records) {
self.ids.splice(0, self.ids.length);
self.offset = offset;
self.count = records.length; // TODO: get real count
for (var i=0; i < records.length; i++ ) {

View File

@ -80,8 +80,13 @@ openerp.base.ListView = openerp.base.View.extend( /** @lends openerp.base.ListVi
}
});
},
'row_link': function (e, index) {
self.select_record(index);
'row_link': function (e, index, id, dataset) {
_.extend(self.dataset, {
domain: dataset.domain,
context: dataset.context
}).read_slice([], null, null, function () {
self.select_record(index);
});
}
});
@ -231,7 +236,8 @@ openerp.base.ListView = openerp.base.View.extend( /** @lends openerp.base.ListVi
do_show: function () {
this.$element.show();
if (this.hidden) {
this.do_reload();
this.$element.find('table').append(
this.groups.apoptosis().render());
this.hidden = false;
}
},
@ -376,6 +382,7 @@ openerp.base.ListView.List = Class.extend( /** @lends openerp.base.ListView.List
this.options = opts.options;
this.columns = opts.columns;
this.dataset = opts.dataset;
this.rows = opts.rows;
this.$_element = $('<tbody class="ui-widget-content">')
@ -402,7 +409,8 @@ openerp.base.ListView.List = Class.extend( /** @lends openerp.base.ListView.List
$(self).trigger(
'row_link',
[self.row_position(e.currentTarget),
self.row_id(e.currentTarget)]);
self.row_id(e.currentTarget),
self.dataset]);
});
},
render: function () {
@ -610,6 +618,7 @@ openerp.base.ListView.Groups = Class.extend( /** @lends openerp.base.ListView.Gr
list = new openerp.base.ListView.List({
options: this.options,
columns: this.columns,
dataset: dataset,
rows: rows
});
this.bind_child_events(list);
@ -661,6 +670,7 @@ openerp.base.ListView.Groups = Class.extend( /** @lends openerp.base.ListView.Gr
child.apoptosis();
});
$(this.elements).remove();
return this;
}
});
};