1
0
Fork 0
mirror of https://github.com/NaN-tic/sao-old.git synced 2023-12-14 02:12:52 +01:00

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
This commit is contained in:
C?dric Krier 2017-03-23 23:05:01 +01:00
parent c6d92e8315
commit 33cb5fdd21
3 changed files with 18 additions and 7 deletions

View file

@ -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() {

View file

@ -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) {
if (this.limit) {
this.offset -= this.limit;
}
this.search_filter(search_string);
},
search_next: function(search_string) {
if (this.limit) {
this.offset += this.limit;
}
this.search_filter(search_string);
},
invalid_message: function(record) {

View file

@ -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);