forked from Techsystech/web
[IMP] web_m2x_options: Added limit for o2m field entries
Added the system parameter "web_m2x_options.field_limit_entries" to set the limit of entries that can be displayed.12.0
parent
5427b0e57f
commit
a9c15b35ec
|
@ -115,6 +115,10 @@ If you disable one option, you can enable it for particular field by setting "cr
|
||||||
|
|
||||||
Whether the field should always show "Search more..." entry or not.
|
Whether the field should always show "Search more..." entry or not.
|
||||||
|
|
||||||
|
``web_m2x_options.field_limit_entries`` *int*
|
||||||
|
|
||||||
|
Number of displayed lines on all One2many fields
|
||||||
|
|
||||||
To add these parameters go to Configuration -> Technical -> Parameters -> System Parameters and add new parameters like:
|
To add these parameters go to Configuration -> Technical -> Parameters -> System Parameters and add new parameters like:
|
||||||
|
|
||||||
- web_m2x_options.create: False
|
- web_m2x_options.create: False
|
||||||
|
@ -122,6 +126,7 @@ To add these parameters go to Configuration -> Technical -> Parameters -> System
|
||||||
- web_m2x_options.m2o_dialog: False
|
- web_m2x_options.m2o_dialog: False
|
||||||
- web_m2x_options.limit: 10
|
- web_m2x_options.limit: 10
|
||||||
- web_m2x_options.search_more: True
|
- web_m2x_options.search_more: True
|
||||||
|
- web_m2x_options.field_limit_entries: 5
|
||||||
|
|
||||||
|
|
||||||
Example
|
Example
|
||||||
|
|
|
@ -8,7 +8,7 @@ class IrConfigParameter(models.Model):
|
||||||
def get_web_m2x_options(self):
|
def get_web_m2x_options(self):
|
||||||
opts = ['web_m2x_options.create', 'web_m2x_options.create_edit',
|
opts = ['web_m2x_options.create', 'web_m2x_options.create_edit',
|
||||||
'web_m2x_options.limit', 'web_m2x_options.search_more',
|
'web_m2x_options.limit', 'web_m2x_options.search_more',
|
||||||
'web_m2x_options.m2o_dialog']
|
'web_m2x_options.m2o_dialog', 'web_m2x_options.field_limit_entries']
|
||||||
return {
|
return {
|
||||||
res["key"]: res["value"] for res in self.sudo().search_read(
|
res["key"]: res["value"] for res in self.sudo().search_read(
|
||||||
[['key', 'in', opts]], ["key", "value"])
|
[['key', 'in', opts]], ["key", "value"])
|
||||||
|
|
|
@ -69,6 +69,10 @@ If you disable one option, you can enable it for particular field by setting "cr
|
||||||
|
|
||||||
Whether the field should always show "Search more..." entry or not.
|
Whether the field should always show "Search more..." entry or not.
|
||||||
|
|
||||||
|
``web_m2x_options.field_limit_entries`` *int*
|
||||||
|
|
||||||
|
Number of displayed lines on all One2many fields
|
||||||
|
|
||||||
To add these parameters go to Configuration -> Technical -> Parameters -> System Parameters and add new parameters like:
|
To add these parameters go to Configuration -> Technical -> Parameters -> System Parameters and add new parameters like:
|
||||||
|
|
||||||
- web_m2x_options.create: False
|
- web_m2x_options.create: False
|
||||||
|
@ -76,6 +80,7 @@ To add these parameters go to Configuration -> Technical -> Parameters -> System
|
||||||
- web_m2x_options.m2o_dialog: False
|
- web_m2x_options.m2o_dialog: False
|
||||||
- web_m2x_options.limit: 10
|
- web_m2x_options.limit: 10
|
||||||
- web_m2x_options.search_more: True
|
- web_m2x_options.search_more: True
|
||||||
|
- web_m2x_options.field_limit_entries: 5
|
||||||
|
|
||||||
|
|
||||||
Example
|
Example
|
||||||
|
|
|
@ -361,4 +361,16 @@ odoo.define('web_m2x_options.web_m2x_options', function (require) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Extending class to allow change the limit of o2m registry entries using the
|
||||||
|
// system parameter "web_m2x_options.field_limit_entries".
|
||||||
|
FormView.include({
|
||||||
|
_setSubViewLimit: function (attrs) {
|
||||||
|
this._super(attrs);
|
||||||
|
var limit = ir_options["web_m2x_options.field_limit_entries"];
|
||||||
|
if (!_.isUndefined(limit)) {
|
||||||
|
attrs.limit = parseInt(limit);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue