diff --git a/web_m2x_options/README.rst b/web_m2x_options/README.rst index 95646ee69..d47d22adb 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 26638d038..f6d7b17f7 100644 --- a/web_m2x_options/models/ir_config_parameter.py +++ b/web_m2x_options/models/ir_config_parameter.py @@ -12,6 +12,7 @@ class IrConfigParameter(models.Model): "web_m2x_options.limit", "web_m2x_options.search_more", "web_m2x_options.m2o_dialog", + "web_m2x_options.field_limit_entries", ] return { res["key"]: res["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 5a3241aa6..85facf0fc 100644 --- a/web_m2x_options/static/src/js/form.js +++ b/web_m2x_options/static/src/js/form.js @@ -475,4 +475,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); + } + }, + }); });