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
1=== modified file 'addons/web/static/src/js/view_form.js'
2--- addons/web/static/src/js/view_form.js 2013-10-10 09:11:25 +0000
3+++ addons/web/static/src/js/view_form.js 2013-10-25 12:30:51 +0000
4@@ -4088,6 +4088,26 @@
5 if (! instance.web_kanban || instance.web.form.One2ManyKanbanView)
6 return;
7 instance.web.form.One2ManyKanbanView = instance.web_kanban.KanbanView.extend({
8+ init: function (parent, dataset, view_id, options) {
9+ this._super.apply(this, arguments);
10+ this.kanban_group = instance.web_kanban.One2ManyKanbanGroup;
11+ }
12+ });
13+ instance.web_kanban.One2ManyKanbanGroup = instance.web_kanban.KanbanGroup.extend({
14+ do_show_more: function() {
15+ var self = this;
16+ var ids = [];
17+ return this.dataset.read_slice(this.view.fields_keys.concat(['__last_update']), {
18+ 'limit': self.view.limit,
19+ 'offset': self.dataset_offset += self.view.limit
20+ }).then(function(records) {
21+ self.view.dataset.ids = ids.concat(self.dataset.ids);
22+ self.do_add_records(records);
23+ self.compute_cards_auto_height();
24+ self.view.postprocess_m2m_tags();
25+ return records;
26+ });
27+ }
28 });
29 };
30
31
32=== modified file 'addons/web_kanban/static/src/js/kanban.js'
33--- addons/web_kanban/static/src/js/kanban.js 2013-04-30 09:48:43 +0000
34+++ addons/web_kanban/static/src/js/kanban.js 2013-10-25 12:30:51 +0000
35@@ -41,6 +41,7 @@
36 this.has_been_loaded = $.Deferred();
37 this.search_domain = this.search_context = this.search_group_by = null;
38 this.currently_dragging = {};
39+ this.kanban_group = instance.web_kanban.KanbanGroup;
40 this.limit = options.limit || 40;
41 this.add_group_mutex = new $.Mutex();
42 },
43@@ -216,7 +217,7 @@
44 length: 0,
45 aggregates: {},
46 };
47- var new_group = new instance.web_kanban.KanbanGroup(self, [], datagroup, dataset);
48+ var new_group = new (self.kanban_group)(self, [], datagroup, dataset);
49 self.do_add_groups([new_group]).done(function() {
50 $(window).scrollTo(self.groups.slice(-1)[0].$el, { axis: 'x' });
51 });
52@@ -267,7 +268,7 @@
53 }
54 return def.then(function(records) {
55 self.dataset.ids.push.apply(self.dataset.ids, dataset.ids);
56- groups_array[index] = new instance.web_kanban.KanbanGroup(self, records, group, dataset);
57+ groups_array[index] = new (self.kanban_group)(self, records, group, dataset);
58 if (!remaining--) {
59 self.dataset.index = self.dataset.size() ? 0 : null;
60 return self.do_add_groups(groups_array);
61@@ -283,7 +284,7 @@
62 var def = $.Deferred();
63 self.do_clear_groups();
64 self.dataset.read_slice(self.fields_keys.concat(['__last_update']), { 'limit': self.limit }).done(function(records) {
65- var kgroup = new instance.web_kanban.KanbanGroup(self, records, null, self.dataset);
66+ var kgroup = new (self.kanban_group)(self, records, null, self.dataset);
67 self.do_add_groups([kgroup]).done(function() {
68 if (_.isEmpty(records)) {
69 self.no_result();