diff --git a/src/sao.js b/src/sao.js index b457fd067c..c0cfacfec8 100644 --- a/src/sao.js +++ b/src/sao.js @@ -398,7 +398,8 @@ var Sao = {}; 'view_ids': view_ids, 'domain': domain, 'context': action_ctx, - 'selection_mode': Sao.common.SELECTION_NONE + 'selection_mode': Sao.common.SELECTION_NONE, + 'limit': null }); Sao.Tab.tabs.splice(Sao.Tab.tabs.indexOf(form), 1); form.view_prm.done(function() { diff --git a/src/screen.js b/src/screen.js index 9425204e1d..f93e93ca4e 100644 --- a/src/screen.js +++ b/src/screen.js @@ -622,7 +622,6 @@ this.model_name = model_name; this.model = new Sao.Model(model_name, attributes); this.attributes = jQuery.extend({}, attributes); - this.attributes.limit = this.attributes.limit || Sao.config.limit; this.view_ids = jQuery.extend([], attributes.view_ids); this.view_to_load = jQuery.extend([], attributes.mode || ['tree', 'form']); @@ -635,7 +634,11 @@ this.current_record = null; this.domain = attributes.domain || []; this.size_limit = null; - this.limit = attributes.limit || Sao.config.limit; + if (this.attributes.limit === undefined) { + this.limit = Sao.config.limit; + } else { + this.limit = attributes.limit; + } this.offset = 0; this.order = this.default_order = attributes.order; var access = Sao.common.MODELACCESS.get(model_name); @@ -828,7 +831,8 @@ grp_prm.done(this.display.bind(this)); jQuery.when(grp_prm, count_prm).done(function(group, count) { this.screen_container.but_next.prop('disabled', - !(group.length == this.limit && + !(this.limit !== undefined && + group.length == this.limit && count > this.limit + this.offset)); }.bind(this)); this.screen_container.but_prev.prop('disabled', this.offset <= 0); @@ -1386,11 +1390,15 @@ }); }, search_prev: function(search_string) { - this.offset -= this.limit; + if (this.limit) { + this.offset -= this.limit; + } this.search_filter(search_string); }, search_next: function(search_string) { - this.offset += this.limit; + if (this.limit) { + this.offset += this.limit; + } this.search_filter(search_string); }, invalid_message: function(record) { diff --git a/src/view/form.js b/src/view/form.js index ab5c06c5c1..b94425d0f2 100644 --- a/src/view/form.js +++ b/src/view/form.js @@ -2523,6 +2523,7 @@ function eval_pyson(value){ views_preload: attributes.views || {}, row_activate: this.activate.bind(this), exclude_field: attributes.relation_field || null, + limit: null, pre_validate: attributes.pre_validate }); this.screen.pre_validate = attributes.pre_validate == 1; @@ -2945,7 +2946,8 @@ function eval_pyson(value){ mode: ['tree'], view_ids: (attributes.view_ids || '').split(','), views_preload: attributes.views || {}, - row_activate: this.activate.bind(this) + row_activate: this.activate.bind(this), + limit: null }); this.prm = this.screen.switch_view('tree').done(function() { this.content.append(this.screen.screen_container.el);