diff --git a/addons/web/models/models.py b/addons/web/models/models.py index 7a55026eb05..702f8824895 100644 --- a/addons/web/models/models.py +++ b/addons/web/models/models.py @@ -10,6 +10,8 @@ from odoo.tools import lazy from odoo.tools.misc import get_lang from odoo.exceptions import UserError +SEARCH_PANEL_LIMIT = 200 + class IrActionsActWindowView(models.Model): _inherit = 'ir.actions.act_window.view' @@ -240,7 +242,7 @@ class Base(models.AbstractModel): fields.append(parent_name) return { 'parent_field': parent_name, - 'values': Comodel.with_context(hierarchical_naming=False).search_read([], fields), + 'values': Comodel.with_context(hierarchical_naming=False).search_read([], fields, limit=SEARCH_PANEL_LIMIT), } @api.model @@ -315,7 +317,7 @@ class Base(models.AbstractModel): } # retrieve all possible values, and return them with their label and counter field_names = ['display_name', group_by] if group_by else ['display_name'] - records = Comodel.search_read(comodel_domain, field_names) + records = Comodel.search_read(comodel_domain, field_names, limit=SEARCH_PANEL_LIMIT) for record in records: record_id = record['id'] values = { @@ -330,7 +332,7 @@ class Base(models.AbstractModel): elif field.type == 'many2many': # retrieve all possible values, and return them with their label and counter field_names = ['display_name', group_by] if group_by else ['display_name'] - records = Comodel.search_read(comodel_domain, field_names) + records = Comodel.search_read(comodel_domain, field_names, limit=SEARCH_PANEL_LIMIT) for record in records: record_id = record['id'] values = { diff --git a/addons/web/static/src/js/views/search_panel.js b/addons/web/static/src/js/views/search_panel.js index 377eb723621..6a1d8381fb7 100644 --- a/addons/web/static/src/js/views/search_panel.js +++ b/addons/web/static/src/js/views/search_panel.js @@ -19,6 +19,8 @@ var qweb = core.qweb; // in the arch) var defaultViewTypes = ['kanban', 'tree']; +const SEARCH_PANEL_LIMIT = 200; + /** * Given a arch node, iterate over its children to generate the * description of each section (being either a category or a filter). @@ -279,7 +281,15 @@ var SearchPanel = Widget.extend({ */ _createCategoryTree: function (categoryId, values) { var category = this.categories[categoryId]; - var parentField = category.parentField; + + let parentField = category.parentField; + if (values.length === SEARCH_PANEL_LIMIT) { + category.limitAttained = true; + if (parentField) { + // we do not hierarchize values + parentField = false; + } + } category.values = {}; _.each(values, function (value) { @@ -324,6 +334,10 @@ var SearchPanel = Widget.extend({ _createFilterTree: function (filterId, values) { var filter = this.filters[filterId]; + if (values.length === SEARCH_PANEL_LIMIT) { + filter.limitAttained = true; + } + // restore checked property values.forEach(function (value) { var oldValue = filter.values && filter.values[value.id]; diff --git a/addons/web/static/src/xml/kanban.xml b/addons/web/static/src/xml/kanban.xml index 48d95dd00b3..e4ef2393e3f 100644 --- a/addons/web/static/src/xml/kanban.xml +++ b/addons/web/static/src/xml/kanban.xml @@ -236,6 +236,10 @@ +
+ For performance reasons, only 200 values were fetched. Some values might be missing. + The values have not been hierarchized. +
@@ -271,6 +275,9 @@ +
+ For performance reasons, only 200 values were fetched. Some values might be missing. +