diff --git a/web_m2x_options/README.rst b/web_m2x_options/README.rst index 31d628b1e..bcbb38ab8 100644 --- a/web_m2x_options/README.rst +++ b/web_m2x_options/README.rst @@ -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. +``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: - 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.limit: 10 - web_m2x_options.search_more: True +- web_m2x_options.field_limit_entries: 5 Example diff --git a/web_m2x_options/models/ir_config_parameter.py b/web_m2x_options/models/ir_config_parameter.py index e7f46e1ed..7fbaaa6bf 100644 --- a/web_m2x_options/models/ir_config_parameter.py +++ b/web_m2x_options/models/ir_config_parameter.py @@ -8,7 +8,7 @@ class IrConfigParameter(models.Model): def get_web_m2x_options(self): opts = ['web_m2x_options.create', 'web_m2x_options.create_edit', '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 { res["key"]: res["value"] for res in self.sudo().search_read( [['key', 'in', opts]], ["key", "value"]) diff --git a/web_m2x_options/readme/USAGE.rst b/web_m2x_options/readme/USAGE.rst index 65ab3e969..b6bb6aa2e 100644 --- a/web_m2x_options/readme/USAGE.rst +++ b/web_m2x_options/readme/USAGE.rst @@ -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. +``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: - 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.limit: 10 - web_m2x_options.search_more: True +- web_m2x_options.field_limit_entries: 5 Example diff --git a/web_m2x_options/static/src/js/form.js b/web_m2x_options/static/src/js/form.js index a4e46fb0e..10a3f6520 100644 --- a/web_m2x_options/static/src/js/form.js +++ b/web_m2x_options/static/src/js/form.js @@ -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); + } + }, + }); });