From 33cb5fdd2124c379bd4df2a8808f3ac7dd3ece18 Mon Sep 17 00:00:00 2001 From: C?dric Krier Date: Thu, 23 Mar 2017 23:05:01 +0100 Subject: [PATCH] Use None as limit for xxx2Many and menu The sort uses search_filter to retrieve the sorted ids list but this method use the limit attribute of the screen. The xxx2Many values has no limit. issue6363 review32161002 --- src/sao.js | 3 ++- src/screen.js | 18 +++++++++++++----- src/view/form.js | 4 +++- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/sao.js b/src/sao.js index b457fd0..c0cfacf 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 9425204..f93e93c 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 ab5c06c..b94425d 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);