[IMP] web: Kanban: keep loaded records when reloading
In a grouped Kanban view, when the user clicks on 'Load More' to load more records of a given column, then opens one of those records in the form view, and goes back using the breadcrumbs, the formerly loaded records should be reloaded, so that the user does not have to click again on 'Load More' to get to the position he was previously. This rev. increases the limit of the given column when the user clicks on 'Load More' to force this behavior.
This commit is contained in:
@@ -3652,6 +3652,10 @@ var BasicModel = AbstractModel.extend({
|
||||
// Also keep data if we only reload groups' own data
|
||||
delete updatedProps.data;
|
||||
}
|
||||
// set the limit such that all previously loaded records
|
||||
// (e.g. if we are coming back to the kanban view from a
|
||||
// form view) are reloaded
|
||||
oldGroup.limit = oldGroup.limit + oldGroup.loadMoreOffset;
|
||||
_.extend(oldGroup, updatedProps);
|
||||
newGroup = oldGroup;
|
||||
} else if (!newGroup.openGroupByDefault) {
|
||||
|
||||
@@ -1962,10 +1962,9 @@ QUnit.module('Views', {
|
||||
"the records should be correctly fetched");
|
||||
|
||||
// reload
|
||||
envIDs = [1, 2, 4]; // first group is limited again to 2 records
|
||||
kanban.reload();
|
||||
assert.strictEqual(kanban.$('.o_kanban_group:eq(1) .o_kanban_record').length, 2,
|
||||
"there should be 2 records in the column after reload");
|
||||
assert.strictEqual(kanban.$('.o_kanban_group:eq(1) .o_kanban_record').length, 3,
|
||||
"there should still be 3 records in the column after reload");
|
||||
|
||||
kanban.destroy();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user