3
0
Fork 0

[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.
17.0
Carlos Roca 2020-11-09 12:00:09 +01:00 committed by manu
parent eade95d350
commit f7a0b315c0
4 changed files with 23 additions and 0 deletions

View File

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

View File

@ -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"]

View File

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

View File

@ -474,4 +474,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);
}
},
});
});