Merge lp:~openerp-dev/openerp-web/7.0-opw-596675-msh into lp:openerp-web/7.0

Proposed by Mohammed Shekha(Open ERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openerp-web/7.0-opw-596675-msh
Merge into: lp:openerp-web/7.0
Diff against target: 69 lines (+24/-3)
2 files modified
addons/web/static/src/js/view_form.js (+20/-0)
addons/web_kanban/static/src/js/kanban.js (+4/-3)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/7.0-opw-596675-msh
Reviewer Review Type Date Requested Status
Fabien Meghazi (OpenERP) Pending
Xavier (Open ERP) Pending
Review via email: mp+192687@code.launchpad.net

Description of the change

Hello,

Kanban View Probelm in One2many: Fixed the issue of kanban view, for one2many kanban view ids should not be sliced in do_show_more method, as one2many kanban uses Buffered Dataset, so ids should be as it is, so extended the KanbanGroup and overrided the do_show_more method.

Demo: Create records more than 40 for contact(res.partner), you will find Show More button at the end of one2many kanban view, but when you click on it nothin happens, it does not load next 40 records.

Thanks

To post a comment you must log in.

Unmerged revisions

4029. By Mohammed Shekha(OpenERP)<email address hidden>

[FIX]Fixed the issue of kanban view, for one2many kanban view ids should not be sliced in do_show_more method, as one2many kanban uses Buffered Dataset, so ids should be as it is, so extended the KanbanGroup and overrided the do_show_more method.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'addons/web/static/src/js/view_form.js'
--- addons/web/static/src/js/view_form.js 2013-10-10 09:11:25 +0000
+++ addons/web/static/src/js/view_form.js 2013-10-25 12:30:51 +0000
@@ -4088,6 +4088,26 @@
4088 if (! instance.web_kanban || instance.web.form.One2ManyKanbanView)4088 if (! instance.web_kanban || instance.web.form.One2ManyKanbanView)
4089 return;4089 return;
4090 instance.web.form.One2ManyKanbanView = instance.web_kanban.KanbanView.extend({4090 instance.web.form.One2ManyKanbanView = instance.web_kanban.KanbanView.extend({
4091 init: function (parent, dataset, view_id, options) {
4092 this._super.apply(this, arguments);
4093 this.kanban_group = instance.web_kanban.One2ManyKanbanGroup;
4094 }
4095 });
4096 instance.web_kanban.One2ManyKanbanGroup = instance.web_kanban.KanbanGroup.extend({
4097 do_show_more: function() {
4098 var self = this;
4099 var ids = [];
4100 return this.dataset.read_slice(this.view.fields_keys.concat(['__last_update']), {
4101 'limit': self.view.limit,
4102 'offset': self.dataset_offset += self.view.limit
4103 }).then(function(records) {
4104 self.view.dataset.ids = ids.concat(self.dataset.ids);
4105 self.do_add_records(records);
4106 self.compute_cards_auto_height();
4107 self.view.postprocess_m2m_tags();
4108 return records;
4109 });
4110 }
4091 });4111 });
4092};4112};
40934113
40944114
=== modified file 'addons/web_kanban/static/src/js/kanban.js'
--- addons/web_kanban/static/src/js/kanban.js 2013-04-30 09:48:43 +0000
+++ addons/web_kanban/static/src/js/kanban.js 2013-10-25 12:30:51 +0000
@@ -41,6 +41,7 @@
41 this.has_been_loaded = $.Deferred();41 this.has_been_loaded = $.Deferred();
42 this.search_domain = this.search_context = this.search_group_by = null;42 this.search_domain = this.search_context = this.search_group_by = null;
43 this.currently_dragging = {};43 this.currently_dragging = {};
44 this.kanban_group = instance.web_kanban.KanbanGroup;
44 this.limit = options.limit || 40;45 this.limit = options.limit || 40;
45 this.add_group_mutex = new $.Mutex();46 this.add_group_mutex = new $.Mutex();
46 },47 },
@@ -216,7 +217,7 @@
216 length: 0,217 length: 0,
217 aggregates: {},218 aggregates: {},
218 };219 };
219 var new_group = new instance.web_kanban.KanbanGroup(self, [], datagroup, dataset);220 var new_group = new (self.kanban_group)(self, [], datagroup, dataset);
220 self.do_add_groups([new_group]).done(function() {221 self.do_add_groups([new_group]).done(function() {
221 $(window).scrollTo(self.groups.slice(-1)[0].$el, { axis: 'x' });222 $(window).scrollTo(self.groups.slice(-1)[0].$el, { axis: 'x' });
222 });223 });
@@ -267,7 +268,7 @@
267 }268 }
268 return def.then(function(records) {269 return def.then(function(records) {
269 self.dataset.ids.push.apply(self.dataset.ids, dataset.ids);270 self.dataset.ids.push.apply(self.dataset.ids, dataset.ids);
270 groups_array[index] = new instance.web_kanban.KanbanGroup(self, records, group, dataset);271 groups_array[index] = new (self.kanban_group)(self, records, group, dataset);
271 if (!remaining--) {272 if (!remaining--) {
272 self.dataset.index = self.dataset.size() ? 0 : null;273 self.dataset.index = self.dataset.size() ? 0 : null;
273 return self.do_add_groups(groups_array);274 return self.do_add_groups(groups_array);
@@ -283,7 +284,7 @@
283 var def = $.Deferred();284 var def = $.Deferred();
284 self.do_clear_groups();285 self.do_clear_groups();
285 self.dataset.read_slice(self.fields_keys.concat(['__last_update']), { 'limit': self.limit }).done(function(records) {286 self.dataset.read_slice(self.fields_keys.concat(['__last_update']), { 'limit': self.limit }).done(function(records) {
286 var kgroup = new instance.web_kanban.KanbanGroup(self, records, null, self.dataset);287 var kgroup = new (self.kanban_group)(self, records, null, self.dataset);
287 self.do_add_groups([kgroup]).done(function() {288 self.do_add_groups([kgroup]).done(function() {
288 if (_.isEmpty(records)) {289 if (_.isEmpty(records)) {
289 self.no_result();290 self.no_result();