← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~camptocamp/ocb-web/ocb-7.0-opw-599269_fix_1239851-msh into lp:ocb-web

 

Alexandre Fayolle - camptocamp has proposed merging lp:~camptocamp/ocb-web/ocb-7.0-opw-599269_fix_1239851-msh into lp:ocb-web.

Requested reviews:
  OpenERP Community Backports Team (ocb)
Related bugs:
  Bug #1239851 in OpenERP Community Backports (Web): "7.0: pagination problem in partial picking wizard display"
  https://bugs.launchpad.net/ocb-web/+bug/1239851

For more details, see:
https://code.launchpad.net/~camptocamp/ocb-web/ocb-7.0-opw-599269_fix_1239851-msh/+merge/208407

[FIX] pagination problem in partial picking wizard display

port of https://code.launchpad.net/~openerp-dev/openerp-web/7.0-opw-599269-msh/+merge/193027  to OCB
-- 
https://code.launchpad.net/~camptocamp/ocb-web/ocb-7.0-opw-599269_fix_1239851-msh/+merge/208407
Your team OpenERP Community Backports Team is requested to review the proposed merge of lp:~camptocamp/ocb-web/ocb-7.0-opw-599269_fix_1239851-msh into lp:ocb-web.
=== modified file 'addons/web/static/src/js/view_list.js'
--- addons/web/static/src/js/view_list.js	2014-02-17 10:49:20 +0000
+++ addons/web/static/src/js/view_list.js	2014-02-26 15:37:53 +0000
@@ -403,6 +403,9 @@
         if (total) {
             var range_start = this.page * limit + 1;
             var range_stop = range_start - 1 + limit;
+            if (this.records.length) {
+                range_stop = range_start - 1 + this.records.length;
+            }
             if (range_stop > total) {
                 range_stop = total;
             }
@@ -597,7 +600,17 @@
             _(ids).each(function (id) {
                 self.records.remove(self.records.get(id));
             });
-            self.configure_pager(self.dataset);
+            if (self.records.length == 0 && self.dataset.size() > 0) {
+                //Trigger previous manually to navigate to previous page, 
+                //If all records are deleted on current page.
+                self.$pager.find('ul li:first a').trigger('click');
+            } else if (self.dataset.size() == self.limit()) {
+                //Reload listview to update current page with next page records 
+                //because pager going to be hide if dataset.size == limit
+                self.reload();
+            } else {
+                self.configure_pager(self.dataset);
+            }
             self.compute_aggregates();
         });
     },


Follow ups